Interface AuthenticationHandler

All Superinterfaces:
org.apereo.cas.util.NamedObject, org.springframework.core.Ordered
All Known Subinterfaces:
PrePostAuthenticationHandler
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface AuthenticationHandler extends org.springframework.core.Ordered, org.apereo.cas.util.NamedObject
An authentication handler authenticates a single credential. In many cases credentials are authenticated by comparison with data in a system of record such as LDAP directory or database.
Since:
4.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Attribute name containing collection of handler names that successfully authenticated credential.

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Method Summary

    Modifier and Type
    Method
    Description
    authenticate(Credential credential, Service service)
    Authenticates the given credential.
    Disabled authentication handler.
    default int
     
    default org.apereo.cas.configuration.model.core.authentication.AuthenticationHandlerStates
    Define the state of the authentication handler.
    default boolean
    supports(Class<? extends Credential> clazz)
    Supports credential class.
    default boolean
    supports(Credential credential)
    Determines whether the handler has the capability to authenticate the given credential.

    Methods inherited from interface org.apereo.cas.util.NamedObject

    getName
  • Field Details

    • SUCCESSFUL_AUTHENTICATION_HANDLERS

      static final String SUCCESSFUL_AUTHENTICATION_HANDLERS
      Attribute name containing collection of handler names that successfully authenticated credential.
      See Also:
  • Method Details

    • disabled

      static AuthenticationHandler disabled()
      Disabled authentication handler.
      Returns:
      the authentication handler
    • authenticate

      AuthenticationHandlerExecutionResult authenticate(Credential credential, Service service) throws Throwable
      Authenticates the given credential. There are three possible outcomes of this process, and implementers MUST adhere to the following contract:
      1. Success -- return AuthenticationHandlerExecutionResult
      2. Failure -- throw GeneralSecurityException
      3. Indeterminate -- throw PreventedException
      Parameters:
      credential - The credential to authenticate.
      service - the requesting service, if any.
      Returns:
      A result object containing metadata about a successful authentication event that includes at a minimum the name of the handler that authenticated the credential and some credential metadata. The following data is optional:
      • Principal
      • Messages issued by the handler about the credential (e.g. impending password expiration warning)
      Throws:
      Throwable - the throwable
    • supports

      default boolean supports(Credential credential)
      Determines whether the handler has the capability to authenticate the given credential. In practical terms, the authenticate(Credential, Service) method MUST be capable of processing a given credential if supports returns true on the same credential.
      Parameters:
      credential - The credential to check.
      Returns:
      True if the handler supports the Credential, false otherwise.
    • supports

      default boolean supports(Class<? extends Credential> clazz)
      Supports credential class.
      Parameters:
      clazz - the clazz
      Returns:
      true/false
    • getOrder

      default int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • getState

      default org.apereo.cas.configuration.model.core.authentication.AuthenticationHandlerStates getState()
      Define the state of the authentication handler.
      Returns:
      the state