com.holonplatform.auth.internal

## Class DefaultCallbackAuthenticator<T extends AuthenticationToken>

- java.lang.Object
- - com.holonplatform.auth.internal.DefaultCallbackAuthenticator<T>

- Type Parameters:
    `T` - Authentication token type
  All Implemented Interfaces:
    Authenticator<T>

      public class DefaultCallbackAuthenticator<T extends AuthenticationToken>
      extends Object
      implements Authenticator<T>

  A default `Authenticator` implementation which uses a callback `Function` to perform the authentication strategy.
  Since:
    5.0.4

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.auth.Authenticator

      `Authenticator.MessageAuthenticator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultCallbackAuthenticator(Class<? extends T> tokenType, Function<T,Authentication> callback)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Authentication` | `authenticate(T authenticationToken)` Attempts to perform authentication using given `AuthenticationToken`.
    `Class<? extends T>` | `getTokenType()` Get supported `AuthenticationToken` type

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.auth.Authenticator

      `create`

- - ### Constructor Detail

    - #### DefaultCallbackAuthenticator

          public DefaultCallbackAuthenticator(Class<? extends T> tokenType,
                                              Function<T,Authentication> callback)

      Constructor
      Parameters:
        `tokenType` - Authentication token type (not null)
        `callback` - Authentication function (not null)

  - ### Method Detail

    - #### getTokenType

          public Class<? extends T> getTokenType()

      Description copied from interface: `Authenticator`
      Get supported `AuthenticationToken` type
      Specified by:
        `getTokenType` in interface `Authenticator<T extends AuthenticationToken>`
      Returns:
        Supported `AuthenticationToken` type

    - #### authenticate

          public Authentication authenticate(T authenticationToken)
                                      throws AuthenticationException

      Description copied from interface: `Authenticator`
      Attempts to perform authentication using given `AuthenticationToken`.

      If the authentication is successful, an `Authentication` instance is returned that represents the user's account data and provides authorization operations.

      If authentication is not successful, a suitable exception should be thrown. See the specific exceptions listed below for builtin available authentication errors.

      Specified by:
        `authenticate` in interface `Authenticator<T extends AuthenticationToken>`
      Parameters:
        `authenticationToken` - the authentication request token
      Returns:
        the Authentication that represents principal's account and authorization data
      Throws:
        `AuthenticationException` - Authentication failed
      See Also:
        `DisabledAccountException`, `LockedAccountException`, `UnknownAccountException`, `ExpiredCredentialsException`, `InvalidCredentialsException`, `UnsupportedTokenException`, `UnexpectedAuthenticationException`

Copyright © 2019 The Holon Platform. All rights reserved.