Package org.nuxeo.ecm.jwt
Class JWTServiceImpl.JWTBuilderImpl
- java.lang.Object
-
- org.nuxeo.ecm.jwt.JWTServiceImpl.JWTBuilderImpl
-
- All Implemented Interfaces:
JWTService.JWTBuilder
- Enclosing class:
- JWTServiceImpl
public class JWTServiceImpl.JWTBuilderImpl extends Object implements JWTService.JWTBuilder
Implementation ofJWTService.JWTBuilder
delegating to the auth0 JWT library.- Since:
- 10.3
-
-
Field Summary
Fields Modifier and Type Field Description com.auth0.jwt.JWTCreator.Builder
builder
-
Constructor Summary
Constructors Constructor Description JWTBuilderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
withTTL
public JWTServiceImpl.JWTBuilderImpl withTTL(int ttlSeconds)
Description copied from interface:JWTService.JWTBuilder
Adds a TTL (in seconds) to the token to be built.A negative or zero TTL means to use the platform default.
- Specified by:
withTTL
in interfaceJWTService.JWTBuilder
- Parameters:
ttlSeconds
- the TTL, in seconds
-
withClaim
public JWTServiceImpl.JWTBuilderImpl withClaim(String name, Object value)
Description copied from interface:JWTService.JWTBuilder
Adds a claim to the token to be built. The standard claim names are available inJWTClaims
.- Specified by:
withClaim
in interfaceJWTService.JWTBuilder
- Parameters:
name
- the claim namevalue
- the claim value
-
build
public String build()
Description copied from interface:JWTService.JWTBuilder
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.
- Specified by:
build
in interfaceJWTService.JWTBuilder
- Returns:
- the token
-
-