com.holonplatform.auth.internal

## Class CallbackAuthenticationTokenResolver<M extends Message>

- java.lang.Object
- - com.holonplatform.auth.internal.CallbackAuthenticationTokenResolver<M>

- Type Parameters:
    `M` - Message type
  All Implemented Interfaces:
    AuthenticationToken.AuthenticationTokenResolver<M>

      public class CallbackAuthenticationTokenResolver<M extends Message>
      extends Object
      implements AuthenticationToken.AuthenticationTokenResolver<M>

  An `AuthenticationToken.AuthenticationTokenResolver` implementation which uses a callback function for message token resolution.
  Since:
    5.1.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CallbackAuthenticationTokenResolver(Class<? extends Message> messageType, Function<M,Optional<AuthenticationToken>> resolverFunction, String scheme)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Optional<AuthenticationToken>` | `getAuthenticationToken(M request)` Parse given `request` message and try to obtain an `AuthenticationToken` if request is eligible for this resolver authentication mechanism.
    `Class<? extends Message>` | `getMessageType()` Get supported message type
    `Optional<String>` | `getScheme()` Optional authentication scheme

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

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

    - ### Methods inherited from interface com.holonplatform.auth.AuthenticationToken.AuthenticationTokenResolver

      `create, create`

- - ### Constructor Detail

    - #### CallbackAuthenticationTokenResolver

          public CallbackAuthenticationTokenResolver(Class<? extends Message> messageType,
                                                     Function<M,Optional<AuthenticationToken>> resolverFunction,
                                                     String scheme)

      Constructor.
      Parameters:
        `messageType` - Message type (not null)
        `resolverFunction` - Resolver function (not null)
        `scheme` - Optional authentication scheme

  - ### Method Detail

    - #### getMessageType

          public Class<? extends Message> getMessageType()

      Description copied from interface: `AuthenticationToken.AuthenticationTokenResolver`
      Get supported message type
      Specified by:
        `getMessageType` in interface `AuthenticationToken.AuthenticationTokenResolver<M extends Message>`
      Returns:
        Message type

    - #### getScheme

          public Optional<String> getScheme()

      Description copied from interface: `AuthenticationToken.AuthenticationTokenResolver`
      Optional authentication scheme
      Specified by:
        `getScheme` in interface `AuthenticationToken.AuthenticationTokenResolver<M extends Message>`
      Returns:
        Authentication scheme name, empty if not available

    - #### getAuthenticationToken

          public Optional<AuthenticationToken> getAuthenticationToken(M request)
                                                               throws AuthenticationException

      Description copied from interface: `AuthenticationToken.AuthenticationTokenResolver`
      Parse given `request` message and try to obtain an `AuthenticationToken` if request is eligible for this resolver authentication mechanism.
      Specified by:
        `getAuthenticationToken` in interface `AuthenticationToken.AuthenticationTokenResolver<M extends Message>`
      Parameters:
        `request` - Authentication request
      Returns:
        AuthenticationToken, or an empty Optional if request is not eligible for this resolver authentication mechanism
      Throws:
        `AuthenticationException` - Id resolver recognized given request but it is somehow malformed or incomplete

Copyright © 2019 The Holon Platform. All rights reserved.