Class WebAuthnAuthenticationManager

java.lang.Object
com.webauthn4j.WebAuthnAuthenticationManager

public class WebAuthnAuthenticationManager extends Object
Manager class for WebAuthn authentication operations. This class provides methods for parsing and verifying WebAuthn authentication data. It handles the authentication phase of the WebAuthn authentication process, including signature verification and custom authentication verification.
  • Constructor Details

    • WebAuthnAuthenticationManager

      public WebAuthnAuthenticationManager(@NotNull @NotNull List<CustomAuthenticationVerifier> customAuthenticationVerifiers, @NotNull @NotNull ObjectConverter objectConverter)
      Constructor for WebAuthnAuthenticationManager with custom verifiers and object converter
      Parameters:
      customAuthenticationVerifiers - list of custom authentication verifiers
      objectConverter - converter for object serialization/deserialization
    • WebAuthnAuthenticationManager

      public WebAuthnAuthenticationManager(@NotNull @NotNull List<CustomAuthenticationVerifier> customAuthenticationVerifiers)
      Constructor for WebAuthnAuthenticationManager with custom verifiers
      Parameters:
      customAuthenticationVerifiers - list of custom authentication verifiers
    • WebAuthnAuthenticationManager

      public WebAuthnAuthenticationManager()
      Default constructor for WebAuthnAuthenticationManager Creates an instance with empty custom authentication verifiers and default object converter
  • Method Details

    • parse

      @NotNull public @NotNull AuthenticationData parse(@NotNull @NotNull String authenticationResponseJSON)
      Parses a WebAuthn authentication response JSON string
      Parameters:
      authenticationResponseJSON - the authentication response in JSON format
      Returns:
      the parsed authentication data
    • parse

      @NotNull public @NotNull AuthenticationData parse(@NotNull @NotNull InputStream authenticationResponseJSON)
      Parses a WebAuthn authentication response JSON from an input stream
      Parameters:
      authenticationResponseJSON - the authentication response in JSON format as an input stream
      Returns:
      the parsed authentication data
    • parse

      @NotNull public @NotNull AuthenticationData parse(@NotNull @NotNull AuthenticationRequest authenticationRequest) throws DataConversionException
      Parses a WebAuthn authentication request
      Parameters:
      authenticationRequest - the authentication request to parse
      Returns:
      the parsed authentication data
      Throws:
      DataConversionException - if data conversion fails
    • verify

      @NotNull public @NotNull AuthenticationData verify(@NotNull @NotNull String authenticationResponseJSON, @NotNull @NotNull AuthenticationParameters authenticationParameters) throws DataConversionException, VerificationException
      Verifies a WebAuthn authentication response JSON string
      Parameters:
      authenticationResponseJSON - the authentication response in JSON format
      authenticationParameters - the parameters for authentication verification
      Returns:
      the verified authentication data
      Throws:
      DataConversionException - if data conversion fails
      VerificationException - if verification fails
    • verify

      @NotNull public @NotNull AuthenticationData verify(@NotNull @NotNull InputStream authenticationResponseJSON, @NotNull @NotNull AuthenticationParameters authenticationParameters) throws DataConversionException, VerificationException
      Verifies a WebAuthn authentication response JSON from an input stream
      Parameters:
      authenticationResponseJSON - the authentication response in JSON format as an input stream
      authenticationParameters - the parameters for authentication verification
      Returns:
      the verified authentication data
      Throws:
      DataConversionException - if data conversion fails
      VerificationException - if verification fails
    • verify

      @NotNull public @NotNull AuthenticationData verify(@NotNull @NotNull AuthenticationRequest authenticationRequest, @NotNull @NotNull AuthenticationParameters authenticationParameters) throws DataConversionException, VerificationException
      Verifies a WebAuthn authentication request
      Parameters:
      authenticationRequest - the authentication request to verify
      authenticationParameters - the parameters for authentication verification
      Returns:
      the verified authentication data
      Throws:
      DataConversionException - if data conversion fails
      VerificationException - if verification fails
    • verify

      @NotNull public @NotNull AuthenticationData verify(@NotNull @NotNull AuthenticationData authenticationData, @NotNull @NotNull AuthenticationParameters authenticationParameters) throws VerificationException
      Verifies WebAuthn authentication data
      Parameters:
      authenticationData - the authentication data to verify
      authenticationParameters - the parameters for authentication verification
      Returns:
      the verified authentication data
      Throws:
      VerificationException - if verification fails
    • getAuthenticationDataVerifier

      @NotNull public @NotNull AuthenticationDataVerifier getAuthenticationDataVerifier()
      Gets the authentication data verifier
      Returns:
      the authentication data verifier