Skip to content

Commit d3332e1

Browse files
committed
Document JDBC Persistence for WebAuthn
Issue gh-16282
1 parent 1f98454 commit d3332e1

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docs/modules/ROOT/pages/servlet/authentication/passkeys.adoc

+43
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,49 @@ open fun userDetailsService(): UserDetailsService {
118118
----
119119
======
120120

121+
122+
[[passkeys-configuration-persistence]]
123+
=== JDBC & Custom Persistence
124+
125+
WebAuthn performs persistence with javadoc:org.springframework.security.web.webauthn.management.PublicKeyCredentialUserEntityRepository[] and javadoc:org.springframework.security.web.webauthn.management.UserCredentialRepository[].
126+
The default is to use in memory persistence, but JDBC persistence is support with javadoc:org.springframework.security.web.webauthn.management.JdbcPublicKeyCredentialUserEntityRepository[] and javadoc:org.springframework.security.web.webauthn.management.JdbcUserCredentialRepository[].
127+
To configure JDBC based persistence, expose the repositories as a Bean:
128+
129+
[tabs]
130+
======
131+
Java::
132+
+
133+
[source,java,role="primary"]
134+
----
135+
@Bean
136+
JdbcPublicKeyCredentialUserEntityRepository jdbcPublicKeyCredentialRepository(JdbcOperations jdbc) {
137+
return new JdbcPublicKeyCredentialUserEntityRepository(jdbc);
138+
}
139+
140+
@Bean
141+
JdbcUserCredentialRepository jdbcUserCredentialRepository(JdbcOperations jdbc) {
142+
return new JdbcUserCredentialRepository(jdbc);
143+
}
144+
----
145+
146+
Kotlin::
147+
+
148+
[source,kotlin,role="secondary"]
149+
----
150+
@Bean
151+
fun jdbcPublicKeyCredentialRepository(jdbc: JdbcOperations): JdbcPublicKeyCredentialUserEntityRepository {
152+
return JdbcPublicKeyCredentialUserEntityRepository(jdbc)
153+
}
154+
155+
@Bean
156+
fun jdbcUserCredentialRepository(jdbc: JdbcOperations): JdbcUserCredentialRepository {
157+
return JdbcUserCredentialRepository(jdbc)
158+
}
159+
----
160+
======
161+
162+
If JDBC does not meet your needs, you can create your own implementations of the interfaces and use them by exposing them as a Bean similar to the example above.
163+
121164
[[passkeys-configuration-pkccor]]
122165
=== Custom PublicKeyCredentialCreationOptionsRepository
123166

docs/modules/ROOT/pages/whats-new.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ Note that this may affect reports that operate on this key name.
1717

1818
== WebAuthn
1919

20+
* https://github.com/spring-projects/spring-security/pull/16282[gh-16282] - xref:servlet/authentication/passkeys.adoc#passkeys-configuration-persistence[JDBC Persistence] for WebAuthn/Passkeys
2021
* https://github.com/spring-projects/spring-security/pull/16397[gh-16397] - Added the ability to configure a custom `HttpMessageConverter` for Passkeys using the optional xref:servlet/authentication/passkeys.adoc#passkeys-configuration[`messageConverter` property] on the `webAuthn` DSL.
2122
* https://github.com/spring-projects/spring-security/pull/16396[gh-16396] - Added the ability to configure a custom xref:servlet/authentication/passkeys.adoc#passkeys-configuration-pkccor[`PublicKeyCredentialCreationOptionsRepository`]

0 commit comments

Comments
 (0)