Class Webauthn4JRelyingPartyOperations
java.lang.Object
org.springframework.security.web.webauthn.management.Webauthn4JRelyingPartyOperations
- All Implemented Interfaces:
WebAuthnRelyingPartyOperations
public class Webauthn4JRelyingPartyOperations
extends Object
implements WebAuthnRelyingPartyOperations
A WebAuthn4j implementation
of
WebAuthnRelyingPartyOperations
.- Since:
- 6.4
-
Constructor Summary
ConstructorDescriptionWebauthn4JRelyingPartyOperations
(PublicKeyCredentialUserEntityRepository userEntities, UserCredentialRepository userCredentials, PublicKeyCredentialRpEntity rpEntity, Set<String> allowedOrigins) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionAuthenticates theRelyingPartyAuthenticationRequest
passed inCreates thePublicKeyCredentialRequestOptions
used to authenticate a user.Creates thePublicKeyCredentialCreationOptions
used to register new credentials.registerCredential
(RelyingPartyRegistrationRequest rpRegistrationRequest) void
setCustomizeCreationOptions
(Consumer<PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder> customizeCreationOptions) void
setCustomizeRequestOptions
(Consumer<PublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder> customizeRequestOptions) Sets aConsumer
used to customize thePublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder
forcreateCredentialRequestOptions(PublicKeyCredentialRequestOptionsRequest)
.The default values are always populated, but can be overridden with this property.void
setWebAuthnManager
(com.webauthn4j.WebAuthnManager webAuthnManager) Sets theWebAuthnManager
to use.
-
Constructor Details
-
Webauthn4JRelyingPartyOperations
public Webauthn4JRelyingPartyOperations(PublicKeyCredentialUserEntityRepository userEntities, UserCredentialRepository userCredentials, PublicKeyCredentialRpEntity rpEntity, Set<String> allowedOrigins) Creates a new instance.- Parameters:
userEntities
- thePublicKeyCredentialUserEntityRepository
to use.userCredentials
- theUserCredentialRepository
to use.rpEntity
- thePublicKeyCredentialRpEntity
to use.allowedOrigins
- the allowed origins.
-
-
Method Details
-
setWebAuthnManager
public void setWebAuthnManager(com.webauthn4j.WebAuthnManager webAuthnManager) Sets theWebAuthnManager
to use. The default isWebAuthnManager.createNonStrictWebAuthnManager()
- Parameters:
webAuthnManager
- theWebAuthnManager
.
-
setCustomizeCreationOptions
public void setCustomizeCreationOptions(Consumer<PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder> customizeCreationOptions) Sets aConsumer
used to customize thePublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder
forcreatePublicKeyCredentialCreationOptions(PublicKeyCredentialCreationOptionsRequest)
. The default values are always populated, but can be overridden with this property.- Parameters:
customizeCreationOptions
- theConsumer
to customize thePublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder
-
setCustomizeRequestOptions
public void setCustomizeRequestOptions(Consumer<PublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder> customizeRequestOptions) Sets aConsumer
used to customize thePublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder
forcreateCredentialRequestOptions(PublicKeyCredentialRequestOptionsRequest)
.The default values are always populated, but can be overridden with this property.- Parameters:
customizeRequestOptions
- theConsumer
to customize thePublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder
-
createPublicKeyCredentialCreationOptions
public PublicKeyCredentialCreationOptions createPublicKeyCredentialCreationOptions(PublicKeyCredentialCreationOptionsRequest request) Description copied from interface:WebAuthnRelyingPartyOperations
Creates thePublicKeyCredentialCreationOptions
used to register new credentials.- Specified by:
createPublicKeyCredentialCreationOptions
in interfaceWebAuthnRelyingPartyOperations
- Parameters:
request
- thePublicKeyCredentialCreationOptionsRequest
to create thePublicKeyCredentialCreationOptions
- Returns:
- the
PublicKeyCredentialCreationOptions
for theAuthentication
passed in. Cannot be null.
-
registerCredential
Description copied from interface:WebAuthnRelyingPartyOperations
- Specified by:
registerCredential
in interfaceWebAuthnRelyingPartyOperations
- Parameters:
rpRegistrationRequest
- theRelyingPartyRegistrationRequest
to process.- Returns:
- a new
CredentialRecord
-
createCredentialRequestOptions
public PublicKeyCredentialRequestOptions createCredentialRequestOptions(PublicKeyCredentialRequestOptionsRequest request) Description copied from interface:WebAuthnRelyingPartyOperations
Creates thePublicKeyCredentialRequestOptions
used to authenticate a user.- Specified by:
createCredentialRequestOptions
in interfaceWebAuthnRelyingPartyOperations
- Parameters:
request
- thePublicKeyCredentialRequestOptionsRequest
.- Returns:
- the
PublicKeyCredentialRequestOptions
used to authenticate a user.
-
authenticate
Description copied from interface:WebAuthnRelyingPartyOperations
Authenticates theRelyingPartyAuthenticationRequest
passed in- Specified by:
authenticate
in interfaceWebAuthnRelyingPartyOperations
- Parameters:
request
- theRelyingPartyAuthenticationRequest
- Returns:
- the principal name (e.g. username) if authentication was successful
-