com.holonplatform.auth.jwt.internal

## Class JwtUtils

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

- All Implemented Interfaces:
    Serializable

      public final class JwtUtils
      extends Object
      implements Serializable

  JWT handling utility class
  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JwtConfiguration` | `buildFromConfig(JwtConfigProperties config)` Build a `JwtConfiguration` instance form given `ConfigPropertyProvider` using configuration property keys listed in `JwtConfiguration`.
    `static boolean` | `isJWT(String token)` Check if given `token` is a JWT token (unsigned)
    `static boolean` | `isJWT(String token, byte[] signingKey)` Check if given `token` is a JWT token (signed)
    `static boolean` | `isJWT(String token, Key signingKey)` Check if given `token` is a JWT token (signed)

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

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

- - ### Method Detail

    - #### isJWT

          public static boolean isJWT(String token)

      Check if given `token` is a JWT token (unsigned)
      Parameters:
        `token` - Token to check
      Returns:
        `true` if it is a JWT token

    - #### isJWT

          public static boolean isJWT(String token,
                                      byte[] signingKey)

      Check if given `token` is a JWT token (signed)
      Parameters:
        `token` - Token to check
        `signingKey` - Signing key
      Returns:
        `true` if it is a JWT token

    - #### isJWT

          public static boolean isJWT(String token,
                                      Key signingKey)

      Check if given `token` is a JWT token (signed)
      Parameters:
        `token` - Token to check
        `signingKey` - Signing key
      Returns:
        `true` if it is a JWT token
      Throws:
        `ExpiredCredentialsException` - If token is a JWT token but has expired

    - #### buildFromConfig

          public static JwtConfiguration buildFromConfig(JwtConfigProperties config)
                                                  throws JwtConfiguration.InvalidJwtConfigurationException

      Build a `JwtConfiguration` instance form given `ConfigPropertyProvider` using configuration property keys listed in `JwtConfiguration`.
      Parameters:
        `config` - ConfigPropertyProvider
      Returns:
        JwtConfiguration
      Throws:
        `JwtConfiguration.InvalidJwtConfigurationException` - Error building configuration

Copyright © 2019 The Holon Platform. All rights reserved.