Class AbstractUsernamePasswordAuthenticationHandler

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apereo.cas.authentication.AuthenticationPasswordPolicyHandlingStrategy passwordPolicyHandlingStrategy
      Decide how to execute password policy handling, if at all.
      • Fields inherited from interface org.apereo.cas.authentication.AuthenticationHandler

        SUCCESSFUL_AUTHENTICATION_HANDLERS
      • Fields inherited from interface org.springframework.core.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractUsernamePasswordAuthenticationHandler​(java.lang.String name, org.apereo.cas.services.ServicesManager servicesManager, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.lang.Integer order)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract org.apereo.cas.authentication.AuthenticationHandlerExecutionResult authenticateUsernamePasswordInternal​(UsernamePasswordCredential credential, java.lang.String originalPassword)
      Authenticates a username/password credential by an arbitrary strategy with extra parameter original credential password before encoding password.
      protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResult doAuthentication​(org.apereo.cas.authentication.Credential credential)
      Performs the details of authentication and returns an authentication handler result on success.
      protected boolean matches​(java.lang.CharSequence charSequence, java.lang.String password)
      Used in case passwordEncoder is used to match raw password with encoded password.
      boolean supports​(java.lang.Class<? extends org.apereo.cas.authentication.Credential> clazz)  
      boolean supports​(org.apereo.cas.authentication.Credential credential)  
      • Methods inherited from interface org.apereo.cas.authentication.AuthenticationHandler

        getName, getOrder
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apereo.cas.authentication.PrePostAuthenticationHandler

        postAuthenticate, preAuthenticate
    • Field Detail

      • passwordPolicyHandlingStrategy

        protected org.apereo.cas.authentication.AuthenticationPasswordPolicyHandlingStrategy passwordPolicyHandlingStrategy
        Decide how to execute password policy handling, if at all.
    • Constructor Detail

      • AbstractUsernamePasswordAuthenticationHandler

        public AbstractUsernamePasswordAuthenticationHandler​(java.lang.String name,
                                                             org.apereo.cas.services.ServicesManager servicesManager,
                                                             org.apereo.cas.authentication.principal.PrincipalFactory principalFactory,
                                                             java.lang.Integer order)
    • Method Detail

      • authenticateUsernamePasswordInternal

        protected abstract org.apereo.cas.authentication.AuthenticationHandlerExecutionResult authenticateUsernamePasswordInternal​(UsernamePasswordCredential credential,
                                                                                                                                   java.lang.String originalPassword)
                                                                                                                            throws java.security.GeneralSecurityException,
                                                                                                                                   org.apereo.cas.authentication.PreventedException
        Authenticates a username/password credential by an arbitrary strategy with extra parameter original credential password before encoding password. Override it if implementation need to use original password for authentication.
        Parameters:
        credential - the credential object bearing the transformed username and password.
        originalPassword - original password from credential before password encoding
        Returns:
        AuthenticationHandlerExecutionResult resolved from credential on authentication success or null if no principal could be resolved from the credential.
        Throws:
        java.security.GeneralSecurityException - On authentication failure.
        org.apereo.cas.authentication.PreventedException - On the indeterminate case when authentication is prevented.
      • supports

        public boolean supports​(java.lang.Class<? extends org.apereo.cas.authentication.Credential> clazz)
      • supports

        public boolean supports​(org.apereo.cas.authentication.Credential credential)
      • matches

        protected boolean matches​(java.lang.CharSequence charSequence,
                                  java.lang.String password)
        Used in case passwordEncoder is used to match raw password with encoded password. Mainly for BCRYPT password encoders where each encoded password is different and we cannot use traditional compare of encoded strings to check if passwords match
        Parameters:
        charSequence - raw not encoded password
        password - encoded password to compare with
        Returns:
        true in case charSequence matched encoded password