Class JWTServiceImpl

All Implemented Interfaces:
JWTService, Adaptable, Component, Extensible, TimestampedService

public class JWTServiceImpl extends DefaultComponent implements JWTService
The JSON Web Token Service implementation.
Since:
10.3
  • Field Details

  • Constructor Details

    • JWTServiceImpl

      public JWTServiceImpl()
  • Method Details

    • registerContribution

      public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
      Overrides:
      registerContribution in class DefaultComponent
    • unregisterContribution

      public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
      Overrides:
      unregisterContribution in class DefaultComponent
    • newBuilder

      public JWTService.JWTBuilder newBuilder()
      Description copied from interface: JWTService
      Creates a new builder for a JSON Web Token.
      Specified by:
      newBuilder in interface JWTService
      Returns:
      the new builder
    • builderWithClaim

      protected void builderWithClaim(com.auth0.jwt.JWTCreator.Builder builder, String name, Object value)
    • verifyToken

      public Map<String,Object> verifyToken(String token)
      Description copied from interface: JWTService
      Verifies the token and returns its claims, or null if the token is invalid (corrupted, constructed from an invalid secret, or expired).

      The claim JWTClaims.CLAIM_SUBJECT contains the token's creator user id.

      The token hash algorithm is based on a secret provided by the service configuration.

      Specified by:
      verifyToken in interface JWTService
      Parameters:
      token - the token
      Returns:
      the claims if the token is valid, or null if the token is invalid
    • nodeToValue

      protected static Object nodeToValue(com.fasterxml.jackson.databind.JsonNode node)
      Converts a JsonNode to a Java value.
    • getDefaultTTL

      protected int getDefaultTTL()
    • getAlgorithm

      protected com.auth0.jwt.algorithms.Algorithm getAlgorithm()