Skip to content

Commit 9a897d0

Browse files
franticticktickjzheaux
authored andcommitted
Add Support Postgres To JdbcUserCredentialRepository
Closes spring-projectsgh-16832 Signed-off-by: Max Batischev <[email protected]>
1 parent 4703f9c commit 9a897d0

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

web/src/main/java/org/springframework/security/web/aot/hint/UserCredentialRuntimeHints.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,7 +34,9 @@ class UserCredentialRuntimeHints implements RuntimeHintsRegistrar {
3434

3535
@Override
3636
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
37-
hints.resources().registerPattern("org/springframework/security/user-credentials-schema.sql");
37+
hints.resources()
38+
.registerPattern("org/springframework/security/user-credentials-schema.sql")
39+
.registerPattern("org/springframework/security/user-credentials-schema-postgres.sql");
3840
}
3941

4042
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
create table user_credentials
2+
(
3+
credential_id varchar(1000) not null,
4+
user_entity_user_id varchar(1000) not null,
5+
public_key bytea not null,
6+
signature_count bigint,
7+
uv_initialized boolean,
8+
backup_eligible boolean not null,
9+
authenticator_transports varchar(1000),
10+
public_key_credential_type varchar(100),
11+
backup_state boolean not null,
12+
attestation_object bytea,
13+
attestation_client_data_json bytea,
14+
created timestamp,
15+
last_used timestamp,
16+
label varchar(1000) not null,
17+
primary key (credential_id)
18+
);

web/src/test/java/org/springframework/security/web/aot/hint/UserCredentialRuntimeHintsTests.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -53,7 +53,8 @@ void credentialRecordsSqlFilesHasHints(String schemaFile) {
5353
}
5454

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

5960
}

0 commit comments

Comments
 (0)