Skip to content

Commit 2476875

Browse files
committed
Polish WebAuthn Authentication Builder
Issue gh-17861
1 parent e97a335 commit 2476875

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

webauthn/src/main/java/org/springframework/security/web/webauthn/authentication/WebAuthnAuthentication.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.jspecify.annotations.Nullable;
2323

2424
import org.springframework.security.authentication.AbstractAuthenticationToken;
25-
import org.springframework.security.core.Authentication;
2625
import org.springframework.security.core.GrantedAuthority;
2726
import org.springframework.security.web.webauthn.api.PublicKeyCredentialUserEntity;
2827
import org.springframework.util.Assert;
@@ -81,7 +80,7 @@ public Builder<?> toBuilder() {
8180
}
8281

8382
/**
84-
* A builder preserving the concrete {@link Authentication} type
83+
* A builder of {@link WebAuthnAuthentication} instances
8584
*
8685
* @since 7.0
8786
*/
@@ -94,6 +93,11 @@ private Builder(WebAuthnAuthentication token) {
9493
this.principal = token.principal;
9594
}
9695

96+
/**
97+
* Use this principal. It must be of type {@link PublicKeyCredentialUserEntity}
98+
* @param principal the principal to use
99+
* @return the {@link Builder} for further configurations
100+
*/
97101
@Override
98102
public B principal(@Nullable Object principal) {
99103
Assert.isInstanceOf(PublicKeyCredentialUserEntity.class, principal,

0 commit comments

Comments
 (0)