com.holonplatform.auth.jwt.internal

## Enum DefaultJwtTokenParser

- java.lang.Object
- - java.lang.Enum<DefaultJwtTokenParser>
  - - com.holonplatform.auth.jwt.internal.DefaultJwtTokenParser

- All Implemented Interfaces:
    JwtTokenParser, Serializable, Comparable<DefaultJwtTokenParser>

      public enum DefaultJwtTokenParser
      extends Enum<DefaultJwtTokenParser>
      implements JwtTokenParser

  Default `JwtTokenParser` implementation.
  Since:
    5.1.1

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `INSTANCE`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Authentication.Builder` | `parseJwt(JwtConfiguration configuration, String jwt)` Parse given JWT and obtain it as an `Authentication` instance.
    `static DefaultJwtTokenParser` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static DefaultJwtTokenParser[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.holonplatform.auth.jwt.JwtTokenParser

      `get`

- - ### Enum Constant Detail

    - #### INSTANCE

          public static final DefaultJwtTokenParser INSTANCE

  - ### Method Detail

    - #### values

          public static DefaultJwtTokenParser[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (DefaultJwtTokenParser c : DefaultJwtTokenParser.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static DefaultJwtTokenParser valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### parseJwt

          public Authentication.Builder parseJwt(JwtConfiguration configuration,
                                                 String jwt)
                                          throws JwtConfiguration.InvalidJwtConfigurationException,
                                                 AuthenticationException

      Description copied from interface: `JwtTokenParser`
      Parse given JWT and obtain it as an `Authentication` instance.

      If the `JwtConfiguration.isIncludeDetails()` switch is `true`, the JWT claims will be included in the `Authentication` instance parameter set, using the claim name as detail key.

      If the `JwtConfiguration.isIncludePermissions()` switch is `true`, the default JWT claim named `AuthenticationClaims.CLAIM_NAME_PERMISSIONS`, if present, is parsed to obtain the the authentication permissions.

      Specified by:
        `parseJwt` in interface `JwtTokenParser`
      Parameters:
        `configuration` - JWT configuration to use (not null)
        `jwt` - JWT value (not null)
      Returns:
        The `Authentication` instance which represents the JWT value, if the token is valid.
      Throws:
        `JwtConfiguration.InvalidJwtConfigurationException` - If the JWT confguration is not valid
        `AuthenticationException` - If the JWT token validation fails

Copyright © 2019 The Holon Platform. All rights reserved.