Browse Source

Add Support Postgres To JdbcUserCredentialRepository

Closes gh-16832

Signed-off-by: Max Batischev <mblancer@mail.ru>
pull/16859/head
Max Batischev 10 months ago committed by Josh Cummings
parent
commit
9a897d0b62
  1. 6
      web/src/main/java/org/springframework/security/web/aot/hint/UserCredentialRuntimeHints.java
  2. 18
      web/src/main/resources/org/springframework/security/user-credentials-schema-postgres.sql
  3. 5
      web/src/test/java/org/springframework/security/web/aot/hint/UserCredentialRuntimeHintsTests.java

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

@ -1,5 +1,5 @@ @@ -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.
@ -34,7 +34,9 @@ class UserCredentialRuntimeHints implements RuntimeHintsRegistrar { @@ -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");
}
}

18
web/src/main/resources/org/springframework/security/user-credentials-schema-postgres.sql

@ -0,0 +1,18 @@ @@ -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)
);

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

@ -1,5 +1,5 @@ @@ -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.
@ -53,7 +53,8 @@ public class UserCredentialRuntimeHintsTests { @@ -53,7 +53,8 @@ public class UserCredentialRuntimeHintsTests {
}
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");
}
}

Loading…
Cancel
Save