public class JWTServiceImpl.JWTBuilderImpl extends Object implements JWTService.JWTBuilder
JWTBuilder
delegating to the auth0 JWT library.Modifier and Type | Field and Description |
---|---|
com.auth0.jwt.JWTCreator.Builder |
builder |
Constructor and Description |
---|
JWTBuilderImpl() |
Modifier and Type | Method and Description |
---|---|
String |
build()
Builds and returns the token.
|
JWTServiceImpl.JWTBuilderImpl |
withClaim(String name,
Object value)
Adds a claim to the token to be built.
|
JWTServiceImpl.JWTBuilderImpl |
withTTL(int ttlSeconds)
Adds a TTL (in seconds) to the token to be built.
|
public final com.auth0.jwt.JWTCreator.Builder builder
public JWTBuilderImpl()
public JWTServiceImpl.JWTBuilderImpl withTTL(int ttlSeconds)
JWTService.JWTBuilder
A negative or zero TTL means to use the platform default.
withTTL
in interface JWTService.JWTBuilder
ttlSeconds
- the TTL, in secondspublic JWTServiceImpl.JWTBuilderImpl withClaim(String name, Object value)
JWTService.JWTBuilder
JWTClaims
.withClaim
in interface JWTService.JWTBuilder
name
- the claim namevalue
- the claim valuepublic String build()
JWTService.JWTBuilder
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.
build
in interface JWTService.JWTBuilder
Copyright © 2018 Nuxeo. All rights reserved.