com.holonplatform.auth.jwt.internal

## Class DefaultJwtAuthenticator

- java.lang.Object
- - com.holonplatform.auth.jwt.internal.DefaultJwtAuthenticator

- All Implemented Interfaces:
    Authenticator<BearerAuthenticationToken>, JwtAuthenticator

      public class DefaultJwtAuthenticator
      extends Object
      implements JwtAuthenticator

  Default `JwtAuthenticator` implementation.
  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DefaultJwtAuthenticator.DefaultBuilder` Default `Builder` implementation

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

      `JwtAuthenticator.Builder`

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

      `Authenticator.MessageAuthenticator`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultJwtAuthenticator()` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Authentication` | `authenticate(BearerAuthenticationToken authenticationToken)` Attempts to perform authentication using given `AuthenticationToken`.
    `JwtConfiguration` | `getConfiguration()` Get the `JwtConfiguration` to use to validate and authenticate the JWT tokens
    `Collection<String>` | `getIssuers()` Get the allowed JWT issuers
    `Collection<String>` | `getRequiredClaims()` Get optional required JWT claims
    `Class<? extends BearerAuthenticationToken>` | `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.jwt.JwtAuthenticator

      `builder`

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

      `create`

- - ### Constructor Detail

    - #### DefaultJwtAuthenticator

          public DefaultJwtAuthenticator()

      Constructor

  - ### Method Detail

    - #### getConfiguration

          public JwtConfiguration getConfiguration()

      Description copied from interface: `JwtAuthenticator`
      Get the `JwtConfiguration` to use to validate and authenticate the JWT tokens
      Specified by:
        `getConfiguration` in interface `JwtAuthenticator`
      Returns:
        JwtConfiguration

    - #### getIssuers

          public Collection<String> getIssuers()

      Description copied from interface: `JwtAuthenticator`
      Get the allowed JWT issuers
      Specified by:
        `getIssuers` in interface `JwtAuthenticator`
      Returns:
        Allowed JWT issuers, an empty list if any issuer is allowed

    - #### getRequiredClaims

          public Collection<String> getRequiredClaims()

      Description copied from interface: `JwtAuthenticator`
      Get optional required JWT claims
      Specified by:
        `getRequiredClaims` in interface `JwtAuthenticator`
      Returns:
        Required JWT claims, empty if none

    - #### getTokenType

          public Class<? extends BearerAuthenticationToken> getTokenType()

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

    - #### authenticate

          public Authentication authenticate(BearerAuthenticationToken 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<BearerAuthenticationToken>`
      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.