Interface JWTService.JWTBuilder

All Known Implementing Classes:
JWTServiceImpl.JWTBuilderImpl
Enclosing interface:
JWTService

public static interface JWTService.JWTBuilder
A builder for a JSON Web Token (JWT).
Since:
10.3
  • Method Details

    • withTTL

      JWTService.JWTBuilder withTTL(int ttlSeconds)
      Adds a TTL (in seconds) to the token to be built.

      A negative or zero TTL means to use the platform default.

      Parameters:
      ttlSeconds - the TTL, in seconds
    • withClaim

      JWTService.JWTBuilder withClaim(String name, Object value)
      Adds a claim to the token to be built. The standard claim names are available in JWTClaims.
      Parameters:
      name - the claim name
      value - the claim value
    • build

      String build()
      Builds and returns the token.

      The JWTClaims.CLAIM_SUBJECT of the token is set to the current user id. The JWTClaims.CLAIM_ISSUER of the token is set to the string "nuxeo".

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

      Returns:
      the token