Class PasskeyChainCustomizer

java.lang.Object
com.irurueta.authserver.authorization.api.web.passkeys.PasskeyChainCustomizer
All Implemented Interfaces:
LoginChainCustomizer

public class PasskeyChainCustomizer extends Object implements LoginChainCustomizer
Customizes the login/UI chain with the passkeys (WebAuthn).

http.webAuthn(...) adds the filters of the four framework endpoints (the authentication options, the authentication, the registration options and the registration) and this class makes them safe for this server:

  • the options and the sign-in post are public (CSRF stays on: the page script sends the token), as is the script;
  • the registration endpoints (and the account page that drives them) require a session that satisfies the multi-factor policy of its account, see PasskeyRegistrationAuthorizationManager;
  • the framework's DELETE /webauthn/register/{id} is denied, so a passkey can only be removed through DELETE /api/account/passkeys/{id}, which asks for a recent multi-factor sign-in, and its default registration page is turned off;
  • the WebAuthn filter gets the chain's session strategy (new session id on sign-in) and a user service that refuses disabled accounts. That user service is set as the chain's shared UserDetailsService, so it is chain-wide: every configurer of the login chain that reads the shared object gets the account-status check;
  • a passkey that completes a second-factor step is refused while the user's second factor is locked, see PasskeySecondFactorLockoutFilter. That filter is added before BasicAuthenticationFilter, the position the WebAuthn configurer gives its authentication filter later, when the chain is built; being added first, it runs first.
  • Field Details

    • ORDER

      public static final int ORDER
      Order of the customizer: after the TOTP one.
      See Also:
    • SCRIPT_PATH

      public static final String SCRIPT_PATH
      Path of the browser script of the passkeys, served from static/js.
      See Also:
    • AUTHENTICATION_OPTIONS_PATH

      public static final String AUTHENTICATION_OPTIONS_PATH
      Path that answers the options of an authentication ceremony.
      See Also:
    • AUTHENTICATION_PATH

      public static final String AUTHENTICATION_PATH
      Path that verifies an authentication ceremony.
      See Also:
    • properties

      private final PasskeyProperties properties
      Relying party settings.
    • mfaAuthorizationManager

      private final MfaAuthorizationManager mfaAuthorizationManager
      Applies the multi-factor policy.
    • userDetailsService

      private final org.springframework.security.core.userdetails.UserDetailsService userDetailsService
      Loads the account of the user a passkey belongs to.
    • secondFactorUserResolver

      private final SecondFactorUserResolver secondFactorUserResolver
      Resolves the account of the signed-in user, for the lockout check.
    • checkSecondFactorLockoutUseCase

      private final CheckSecondFactorLockoutUseCase checkSecondFactorLockoutUseCase
      Tells whether the second factor of a user is locked.
  • Constructor Details

    • PasskeyChainCustomizer

      public PasskeyChainCustomizer()
  • Method Details

    • customize

      public void customize(org.springframework.security.config.annotation.web.builders.HttpSecurity http)
      Customizes the login/UI chain.
      Specified by:
      customize in interface LoginChainCustomizer
      Parameters:
      http - security builder of the chain.