Add Support Postgres To JdbcUserCredentialRepository

Closes gh-16832

Signed-off-by: Max Batischev <mblancer@mail.ru>
This commit is contained in:
Max Batischev 2025-03-28 13:10:35 +03:00 committed by Josh Cummings
parent 4703f9cf1c
commit 9a897d0b62
3 changed files with 25 additions and 4 deletions

View File

@ -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 {
@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");
}
}

View File

@ -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)
);

View File

@ -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 {
}
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");
}
}