com.holonplatform.auth.jwt.internal

## Class DefaultJwtConfiguration

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

- All Implemented Interfaces:
    JwtConfiguration, Serializable

      public class DefaultJwtConfiguration
      extends Object
      implements JwtConfiguration

  `JwtConfiguration` implementation
  Since:
    5.0.0
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

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

      `JwtConfiguration.Builder, JwtConfiguration.InvalidJwtConfigurationException`

  - ### Field Summary

    - ### Fields inherited from interface com.holonplatform.auth.jwt.JwtConfiguration

      `CONTEXT_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultJwtConfiguration()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `void` | `setExpireTime(long expireTime)` Set JWT token expire time
    `void` | `setIncludeDetails(boolean includeDetails)` Set whether to include `Authentication` details in JWT token generation
    `void` | `setIncludePermissions(boolean includePermissions)` Set whether to include `Authentication` permissions in JWT token generation
    `void` | `setIssuer(String issuer)` JWT token issuer
    `void` | `setNotBeforeNow(boolean notBeforeNow)` Set whether to set the `nbf` (not before) JWT claim to the timestamp at which the token is created.
    `void` | `setPrivateKey(Key privateKey)` Set JWT signing private key to use with asymmetric signing algorithms (such as RSA)
    `void` | `setPublicKey(Key publicKey)` Set JWT signing public key to use with asymmetric signing algorithms (such as RSA)
    `void` | `setSharedKey(byte[] sharedKey)` Set JWT signing shared key to use with symmetric signing algorithms (such as HMAC)
    `void` | `setSignatureAlgorithm(JwtSignatureAlgorithm signatureAlgorithm)` Set JWT token signature algorithm
    `String` | `toString()`

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

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

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

      `build, builder, getCurrent`

- - ### Constructor Detail

    - #### DefaultJwtConfiguration

          public DefaultJwtConfiguration()

  - ### Method Detail

    - #### getIssuer

          public Optional<String> getIssuer()

      Description copied from interface: `JwtConfiguration`
      Get the JWT token issuer (iss)
      Specified by:
        `getIssuer` in interface `JwtConfiguration`
      Returns:
        Optional issuer

    - #### getSignatureAlgorithm

          public JwtSignatureAlgorithm getSignatureAlgorithm()

      Description copied from interface: `JwtConfiguration`
      Get the JWT token signature algorithm.
      Specified by:
        `getSignatureAlgorithm` in interface `JwtConfiguration`
      Returns:
        The signature algorithm, or `JwtSignatureAlgorithm.NONE` if the JWT token is not signed

    - #### getSharedKey

          public Optional<byte[]> getSharedKey()

      Description copied from interface: `JwtConfiguration`
      Get the shared key to be used with symmetric JWT signature algorithms.
      Specified by:
        `getSharedKey` in interface `JwtConfiguration`
      Returns:
        Optional JWT signing shared key

    - #### getPublicKey

          public Optional<Key> getPublicKey()

      Description copied from interface: `JwtConfiguration`
      Get the public key to be used with asymmetric JWT signature algorithms.
      Specified by:
        `getPublicKey` in interface `JwtConfiguration`
      Returns:
        Optional public key

    - #### getPrivateKey

          public Optional<Key> getPrivateKey()

      Description copied from interface: `JwtConfiguration`
      Get the private key to be used with asymmetric JWT signature algorithms.
      Specified by:
        `getPrivateKey` in interface `JwtConfiguration`
      Returns:
        Optional private key

    - #### getExpireTime

          public long getExpireTime()

      Description copied from interface: `JwtConfiguration`
      Get JWT token expire time.
      Specified by:
        `getExpireTime` in interface `JwtConfiguration`
      Returns:
        The expire time in milliseconds. `<=0` means token never expires

    - #### isNotBeforeNow

          public boolean isNotBeforeNow()

      Description copied from interface: `JwtConfiguration`
      Get whether to set the `nbf` (not before) JWT claim to the timestamp at which the token is created.
      Specified by:
        `isNotBeforeNow` in interface `JwtConfiguration`
      Returns:
        `true` to set the `nbf` (not before) JWT claim to the timestamp at which the token is created

    - #### isIncludeDetails

          public boolean isIncludeDetails()

      Description copied from interface: `JwtConfiguration`
      Get whether to include `Authentication` details in JWT token at token generation time.
      Specified by:
        `isIncludeDetails` in interface `JwtConfiguration`
      Returns:
        `true` to include `Authentication` details in JWT token, `false` otherwise

    - #### isIncludePermissions

          public boolean isIncludePermissions()

      Description copied from interface: `JwtConfiguration`
      Get whether to include `Authentication` permissions in JWT token at token generation time.
      Specified by:
        `isIncludePermissions` in interface `JwtConfiguration`
      Returns:
        `true` to include `Authentication` permissions in JWT token, `false` otherwise

    - #### setIssuer

          public void setIssuer(String issuer)

      JWT token issuer
      Parameters:
        `issuer` - the issuer to set

    - #### setSignatureAlgorithm

          public void setSignatureAlgorithm(JwtSignatureAlgorithm signatureAlgorithm)

      Set JWT token signature algorithm
      Parameters:
        `signatureAlgorithm` - Signature algorithm

    - #### setSharedKey

          public void setSharedKey(byte[] sharedKey)

      Set JWT signing shared key to use with symmetric signing algorithms (such as HMAC)
      Parameters:
        `sharedKey` - the key to set

    - #### setPublicKey

          public void setPublicKey(Key publicKey)

      Set JWT signing public key to use with asymmetric signing algorithms (such as RSA)
      Parameters:
        `publicKey` - the key to set

    - #### setPrivateKey

          public void setPrivateKey(Key privateKey)

      Set JWT signing private key to use with asymmetric signing algorithms (such as RSA)
      Parameters:
        `privateKey` - the key to set

    - #### setExpireTime

          public void setExpireTime(long expireTime)

      Set JWT token expire time
      Parameters:
        `expireTime` - Expire time in milliseconds

    - #### setNotBeforeNow

          public void setNotBeforeNow(boolean notBeforeNow)

      Set whether to set the `nbf` (not before) JWT claim to the timestamp at which the token is created.
      Parameters:
        `notBeforeNow` - `true` to set the `nbf` (not before) JWT claim to the timestamp at which the token is created.

    - #### setIncludeDetails

          public void setIncludeDetails(boolean includeDetails)

      Set whether to include `Authentication` details in JWT token generation
      Parameters:
        `includeDetails` - `true` to include `Authentication` details

    - #### setIncludePermissions

          public void setIncludePermissions(boolean includePermissions)

      Set whether to include `Authentication` permissions in JWT token generation
      Parameters:
        `includePermissions` - `true` to include `Authentication` permissions

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2019 The Holon Platform. All rights reserved.