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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
build()
Builds and returns the token.JWTService.JWTBuilder
withClaim(String name, Object value)
Adds a claim to the token to be built.JWTService.JWTBuilder
withTTL(int ttlSeconds)
Adds a TTL (in seconds) to the token to be built.
-
-
-
Method Detail
-
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 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
-
-