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.JWTBuilderdelegating to the auth0 JWT library.- Since:
- 10.3
-
-
Field Summary
Fields Modifier and Type Field Description com.auth0.jwt.JWTCreator.Builderbuilder
-
Constructor Summary
Constructors Constructor Description JWTBuilderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbuild()Builds and returns the token.JWTServiceImpl.JWTBuilderImplwithClaim(String name, Object value)Adds a claim to the token to be built.JWTServiceImpl.JWTBuilderImplwithTTL(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.JWTBuilderAdds a TTL (in seconds) to the token to be built.A negative or zero TTL means to use the platform default.
- Specified by:
withTTLin interfaceJWTService.JWTBuilder- Parameters:
ttlSeconds- the TTL, in seconds
-
withClaim
public JWTServiceImpl.JWTBuilderImpl withClaim(String name, Object value)
Description copied from interface:JWTService.JWTBuilderAdds a claim to the token to be built. The standard claim names are available inJWTClaims.- Specified by:
withClaimin interfaceJWTService.JWTBuilder- Parameters:
name- the claim namevalue- the claim value
-
build
public String build()
Description copied from interface:JWTService.JWTBuilderBuilds and returns the token.The
JWTClaims.CLAIM_SUBJECTof the token is set to the current user id. TheJWTClaims.CLAIM_ISSUERof the token is set to the string"nuxeo".The token hash algorithm is based on a secret provided by the service configuration.
- Specified by:
buildin interfaceJWTService.JWTBuilder- Returns:
- the token
-
-