Skip to content

Commit 718c90d

Browse files
committed
Document PublicKeyCredentialCreationOptionsRepository
Issue gh-16396
1 parent 4314e68 commit 718c90d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

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

+36
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,16 @@ Java::
6060
----
6161
@Bean
6262
SecurityFilterChain filterChain(HttpSecurity http) {
63+
// ...
6364
http
6465
// ...
6566
.formLogin(withDefaults())
6667
.webAuthn((webAuthn) -> webAuthn
6768
.rpName("Spring Security Relying Party")
6869
.rpId("example.com")
6970
.allowedOrigins("https://example.com")
71+
// optional properties
72+
.creationOptionsRepository(new CustomPublicKeyCredentialCreationOptionsRepository())
7073
);
7174
return http.build();
7275
}
@@ -89,11 +92,14 @@ Kotlin::
8992
----
9093
@Bean
9194
open fun filterChain(http: HttpSecurity): SecurityFilterChain {
95+
// ...
9296
http {
9397
webAuthn {
9498
rpName = "Spring Security Relying Party"
9599
rpId = "example.com"
96100
allowedOrigins = setOf("https://example.com")
101+
// optional properties
102+
creationOptionsRepository = CustomPublicKeyCredentialCreationOptionsRepository()
97103
}
98104
}
99105
}
@@ -110,6 +116,36 @@ open fun userDetailsService(): UserDetailsService {
110116
----
111117
======
112118

119+
[[passkeys-configuration-pkccor]]
120+
=== Custom PublicKeyCredentialCreationOptionsRepository
121+
122+
The `PublicKeyCredentialCreationOptionsRepository` is used to persist the `PublicKeyCredentialCreationOptions` between requests.
123+
The default is to persist it the `HttpSession`, but at times users may need to customize this behavior.
124+
This can be done by setting the optional property `creationOptionsRepository` demonstrated in xref:./passkeys.adoc#passkeys-configuration[Configuration] or by exposing a `PublicKeyCredentialCreationOptionsRepository` Bean:
125+
126+
[tabs]
127+
======
128+
Java::
129+
+
130+
[source,java,role="primary"]
131+
----
132+
@Bean
133+
CustomPublicKeyCredentialCreationOptionsRepository creationOptionsRepository() {
134+
return new CustomPublicKeyCredentialCreationOptionsRepository();
135+
}
136+
----
137+
138+
Kotlin::
139+
+
140+
[source,kotlin,role="secondary"]
141+
----
142+
@Bean
143+
open fun creationOptionsRepository(): CustomPublicKeyCredentialCreationOptionsRepository {
144+
return CustomPublicKeyCredentialCreationOptionsRepository()
145+
}
146+
----
147+
======
148+
113149
[[passkeys-register]]
114150
== Register a New Credential
115151

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

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ Note that this may affect reports that operate on this key name.
1414
== OAuth
1515

1616
* https://github.com/spring-projects/spring-security/pull/16386[gh-16386] - Enable PKCE for confidential clients using `ClientRegistration.clientSettings.requireProofKey=true` for xref:servlet/oauth2/client/core.adoc#oauth2Client-client-registration-requireProofKey[servlet] and xref:reactive/oauth2/client/core.adoc#oauth2Client-client-registration-requireProofKey[reactive] applications
17+
18+
== WebAuthn
19+
20+
* 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)