com.holonplatform.auth.jwt

## Interface JwtConfiguration

- All Superinterfaces:
    Serializable

      public interface JwtConfiguration
      extends Serializable

  JWT generation/authentication configuration attributes.
  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `JwtConfiguration.Builder` Builder to create `JwtConfiguration` instances.
    `static class` | `JwtConfiguration.InvalidJwtConfigurationException` Exception for `JwtConfiguration` errors.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CONTEXT_KEY` Default `Context` resource reference

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JwtConfiguration` | `build(JwtConfigProperties properties)` Build a `JwtConfiguration` instance using given configuration `properties`.
    `static JwtConfiguration.Builder` | `builder()` Builder to create a `JwtConfiguration`
    `static Optional<JwtConfiguration>` | `getCurrent()` Convenience method to obtain the current `JwtConfiguration` made available as `Context` resource, using default `ClassLoader`.
    `long` | `getExpireTime()` Get JWT token expire time.
    `Optional<String>` | `getIssuer()` Get the JWT token issuer (iss)
    `Optional<Key>` | `getPrivateKey()` Get the private key to be used with asymmetric JWT signature algorithms.
    `Optional<Key>` | `getPublicKey()` Get the public key to be used with asymmetric JWT signature algorithms.
    `Optional<byte[]>` | `getSharedKey()` Get the shared key to be used with symmetric JWT signature algorithms.
    `JwtSignatureAlgorithm` | `getSignatureAlgorithm()` Get the JWT token signature algorithm.
    `boolean` | `isIncludeDetails()` Get whether to include `Authentication` details in JWT token at token generation time.
    `boolean` | `isIncludePermissions()` Get whether to include `Authentication` permissions in JWT token at token generation time.
    `boolean` | `isNotBeforeNow()` Get whether to set the `nbf` (not before) JWT claim to the timestamp at which the token is created.

- - ### Field Detail

    - #### CONTEXT_KEY

          static final String CONTEXT_KEY

      Default `Context` resource reference

  - ### Method Detail

    - #### getIssuer

          Optional<String> getIssuer()

      Get the JWT token issuer (iss)
      Returns:
        Optional issuer

    - #### getSignatureAlgorithm

          JwtSignatureAlgorithm getSignatureAlgorithm()

      Get the JWT token signature algorithm.
      Returns:
        The signature algorithm, or `JwtSignatureAlgorithm.NONE` if the JWT token is not signed

    - #### getSharedKey

          Optional<byte[]> getSharedKey()

      Get the shared key to be used with symmetric JWT signature algorithms.
      Returns:
        Optional JWT signing shared key

    - #### getPrivateKey

          Optional<Key> getPrivateKey()

      Get the private key to be used with asymmetric JWT signature algorithms.
      Returns:
        Optional private key

    - #### getPublicKey

          Optional<Key> getPublicKey()

      Get the public key to be used with asymmetric JWT signature algorithms.
      Returns:
        Optional public key

    - #### getExpireTime

          long getExpireTime()

      Get JWT token expire time.
      Returns:
        The expire time in milliseconds. `<=0` means token never expires

    - #### isNotBeforeNow

          boolean isNotBeforeNow()

      Get whether to set the `nbf` (not before) JWT claim to the timestamp at which the token is created.
      Returns:
        `true` to set the `nbf` (not before) JWT claim to the timestamp at which the token is created

    - #### isIncludeDetails

          boolean isIncludeDetails()

      Get whether to include `Authentication` details in JWT token at token generation time.
      Returns:
        `true` to include `Authentication` details in JWT token, `false` otherwise

    - #### isIncludePermissions

          boolean isIncludePermissions()

      Get whether to include `Authentication` permissions in JWT token at token generation time.
      Returns:
        `true` to include `Authentication` permissions in JWT token, `false` otherwise

    - #### getCurrent

          static Optional<JwtConfiguration> getCurrent()

      Convenience method to obtain the current `JwtConfiguration` made available as `Context` resource, using default `ClassLoader`.

      See `Context.resource(String, Class)` for details about context resources availability conditions.

      Returns:
        Optional JwtConfiguration, empty if not available as context resource

    - #### builder

          static JwtConfiguration.Builder builder()

      Builder to create a `JwtConfiguration`
      Returns:
        JwtConfiguration builder

    - #### build

          static JwtConfiguration build(JwtConfigProperties properties)
                                 throws JwtConfiguration.InvalidJwtConfigurationException

      Build a `JwtConfiguration` instance using given configuration `properties`.
      Parameters:
        `properties` - JWT configuration property source
      Returns:
        JwtConfiguration
      Throws:
        `JwtConfiguration.InvalidJwtConfigurationException` - Error building configuration

Copyright © 2019 The Holon Platform. All rights reserved.