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
ConstructorsConstructorDescriptionWebauthn4JRelyingPartyOperations(PublicKeyCredentialUserEntityRepository userEntities, UserCredentialRepository userCredentials, PublicKeyCredentialRpEntity rpEntity, Set<String> allowedOrigins) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionAuthenticates theRelyingPartyAuthenticationRequestpassed inCreates thePublicKeyCredentialRequestOptionsused to authenticate a user.Creates thePublicKeyCredentialCreationOptionsused to register new credentials.registerCredential(RelyingPartyRegistrationRequest rpRegistrationRequest) voidsetCustomizeCreationOptions(Consumer<PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder> customizeCreationOptions) voidsetCustomizeRequestOptions(Consumer<PublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder> customizeRequestOptions) Sets aConsumerused to customize thePublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilderforcreateCredentialRequestOptions(PublicKeyCredentialRequestOptionsRequest).The default values are always populated, but can be overridden with this property.voidsetWebAuthnManager(com.webauthn4j.WebAuthnManager webAuthnManager) Sets theWebAuthnManagerto use.
-
Constructor Details
-
Webauthn4JRelyingPartyOperations
public Webauthn4JRelyingPartyOperations(PublicKeyCredentialUserEntityRepository userEntities, UserCredentialRepository userCredentials, PublicKeyCredentialRpEntity rpEntity, Set<String> allowedOrigins) Creates a new instance.- Parameters:
userEntities- thePublicKeyCredentialUserEntityRepositoryto use.userCredentials- theUserCredentialRepositoryto use.rpEntity- thePublicKeyCredentialRpEntityto use.allowedOrigins- the allowed origins.
-
-
Method Details
-
setWebAuthnManager
public void setWebAuthnManager(com.webauthn4j.WebAuthnManager webAuthnManager) Sets theWebAuthnManagerto use. The default isWebAuthnManager.createNonStrictWebAuthnManager()- Parameters:
webAuthnManager- theWebAuthnManager.
-
setCustomizeCreationOptions
public void setCustomizeCreationOptions(Consumer<PublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder> customizeCreationOptions) Sets aConsumerused to customize thePublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilderforcreatePublicKeyCredentialCreationOptions(PublicKeyCredentialCreationOptionsRequest). The default values are always populated, but can be overridden with this property.- Parameters:
customizeCreationOptions- theConsumerto customize thePublicKeyCredentialCreationOptions.PublicKeyCredentialCreationOptionsBuilder
-
setCustomizeRequestOptions
public void setCustomizeRequestOptions(Consumer<PublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder> customizeRequestOptions) Sets aConsumerused to customize thePublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilderforcreateCredentialRequestOptions(PublicKeyCredentialRequestOptionsRequest).The default values are always populated, but can be overridden with this property.- Parameters:
customizeRequestOptions- theConsumerto customize thePublicKeyCredentialRequestOptions.PublicKeyCredentialRequestOptionsBuilder
-
createPublicKeyCredentialCreationOptions
public PublicKeyCredentialCreationOptions createPublicKeyCredentialCreationOptions(PublicKeyCredentialCreationOptionsRequest request) Description copied from interface:WebAuthnRelyingPartyOperationsCreates thePublicKeyCredentialCreationOptionsused to register new credentials.- Specified by:
createPublicKeyCredentialCreationOptionsin interfaceWebAuthnRelyingPartyOperations- Parameters:
request- thePublicKeyCredentialCreationOptionsRequestto create thePublicKeyCredentialCreationOptions- Returns:
- the
PublicKeyCredentialCreationOptionsfor theAuthenticationpassed in. Cannot be null.
-
registerCredential
Description copied from interface:WebAuthnRelyingPartyOperations- Specified by:
registerCredentialin interfaceWebAuthnRelyingPartyOperations- Parameters:
rpRegistrationRequest- theRelyingPartyRegistrationRequestto process.- Returns:
- a new
CredentialRecord
-
createCredentialRequestOptions
public PublicKeyCredentialRequestOptions createCredentialRequestOptions(PublicKeyCredentialRequestOptionsRequest request) Description copied from interface:WebAuthnRelyingPartyOperationsCreates thePublicKeyCredentialRequestOptionsused to authenticate a user.- Specified by:
createCredentialRequestOptionsin interfaceWebAuthnRelyingPartyOperations- Parameters:
request- thePublicKeyCredentialRequestOptionsRequest.- Returns:
- the
PublicKeyCredentialRequestOptionsused to authenticate a user.
-
authenticate
Description copied from interface:WebAuthnRelyingPartyOperationsAuthenticates theRelyingPartyAuthenticationRequestpassed in- Specified by:
authenticatein interfaceWebAuthnRelyingPartyOperations- Parameters:
request- theRelyingPartyAuthenticationRequest- Returns:
- the principal name (e.g. username) if authentication was successful
-