Class PasskeyRegistrationAuthorizationManager

java.lang.Object
com.irurueta.authserver.authorization.api.web.passkeys.PasskeyRegistrationAuthorizationManager
All Implemented Interfaces:
org.springframework.security.authorization.AuthorizationManager<jakarta.servlet.http.HttpServletRequest>

public class PasskeyRegistrationAuthorizationManager extends Object implements org.springframework.security.authorization.AuthorizationManager<jakarta.servlet.http.HttpServletRequest>
Lets a request to the registration endpoints of the WebAuthn filters (/webauthn/register and everything below it) through only when the session satisfies the multi-factor policy of its account.

Registering a passkey adds a factor that, on its own, signs the account in (it is a strong primary factor). A session that only presented the password of an account that still has to complete its second factor must therefore not be able to register one: it could enrol a passkey it controls and sign in with it, skipping the second factor. Spring's own creation-options filter only demands an authenticated user and answers before the chain's authorization filter, so the rule cannot be written as a request matcher of the chain; this manager is installed in an AuthorizationFilter placed right before it.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Applies the multi-factor policy.
    private static final org.springframework.security.web.util.matcher.RequestMatcher
    Matches the registration endpoints: the options, the registration itself and the removal of a credential.
    static final String
    Path of the registration endpoints of the WebAuthn filters.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.authorization.AuthorizationResult
    authorize(Supplier<? extends org.springframework.security.core.Authentication> authentication, jakarta.servlet.http.HttpServletRequest request)
    Decides for a request.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.security.authorization.AuthorizationManager

    verify
  • Field Details

    • REGISTRATION_PATH

      public static final String REGISTRATION_PATH
      Path of the registration endpoints of the WebAuthn filters.
      See Also:
    • REGISTRATION

      private static final org.springframework.security.web.util.matcher.RequestMatcher REGISTRATION
      Matches the registration endpoints: the options, the registration itself and the removal of a credential.
    • mfaAuthorizationManager

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

    • PasskeyRegistrationAuthorizationManager

      public PasskeyRegistrationAuthorizationManager()
  • Method Details

    • authorize

      public org.springframework.security.authorization.AuthorizationResult authorize(Supplier<? extends org.springframework.security.core.Authentication> authentication, jakarta.servlet.http.HttpServletRequest request)
      Decides for a request.
      Specified by:
      authorize in interface org.springframework.security.authorization.AuthorizationManager<jakarta.servlet.http.HttpServletRequest>
      Parameters:
      authentication - supplier of the current authentication.
      request - the request being served.
      Returns:
      granted for a request that is not a registration endpoint; for one that is, the decision of the multi-factor policy (granted only to a signed-in user whose session satisfies it, otherwise refused, naming the missing second factors so the user is sent to the second-factor page).