Package org.nuxeo.ecm.jwt
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
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
Adds a claim to the token to be built. The standard claim names are available inJWTClaims
.- Parameters:
name
- the claim namevalue
- 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. TheJWTClaims.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
-