Skip to content

Add Support Postgres To JdbcUserCredentialRepository #16839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,9 @@ class UserCredentialRuntimeHints implements RuntimeHintsRegistrar {

@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
hints.resources().registerPattern("org/springframework/security/user-credentials-schema.sql");
hints.resources()
.registerPattern("org/springframework/security/user-credentials-schema.sql")
.registerPattern("org/springframework/security/user-credentials-schema-postgres.sql");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
create table user_credentials
(
credential_id varchar(1000) not null,
user_entity_user_id varchar(1000) not null,
public_key bytea not null,
signature_count bigint,
uv_initialized boolean,
backup_eligible boolean not null,
authenticator_transports varchar(1000),
public_key_credential_type varchar(100),
backup_state boolean not null,
attestation_object bytea,
attestation_client_data_json bytea,
created timestamp,
last_used timestamp,
label varchar(1000) not null,
primary key (credential_id)
);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2024 the original author or authors.
* Copyright 2002-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -53,7 +53,8 @@ void credentialRecordsSqlFilesHasHints(String schemaFile) {
}

private static Stream<String> getClientRecordsSqlFiles() {
return Stream.of("org/springframework/security/user-credentials-schema.sql");
return Stream.of("org/springframework/security/user-credentials-schema.sql",
"org/springframework/security/user-credentials-schema-postgres.sql");
}

}