Package org.nuxeo.ecm.jwt
Class JWTServiceImpl
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.jwt.JWTServiceImpl
- All Implemented Interfaces:
JWTService,Adaptable,Component,Extensible,TimestampedService
The JSON Web Token Service implementation.
- Since:
- 10.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassImplementation ofJWTService.JWTBuilderdelegating to the auth0 JWT library.protected static classNested classes/interfaces inherited from interface org.nuxeo.ecm.jwt.JWTService
JWTService.JWTBuilder -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final com.fasterxml.jackson.databind.ObjectMapperprotected final JWTServiceImpl.JWTServiceConfigurationRegistrystatic final StringFields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuilderWithClaim(com.auth0.jwt.JWTCreator.Builder builder, String name, Object value) protected com.auth0.jwt.algorithms.Algorithmprotected intCreates a new builder for a JSON Web Token.protected static ObjectnodeToValue(com.fasterxml.jackson.databind.JsonNode node) Converts aJsonNodeto a Java value.voidregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) voidunregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) verifyToken(String token) Verifies the token and returns its claims, ornullif the token is invalid (corrupted, constructed from an invalid secret, or expired).Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
XP_CONFIGURATION
- See Also:
-
NUXEO_ISSUER
- See Also:
-
OBJECT_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER -
MAP_STRING_OBJECT
-
registry
-
-
Constructor Details
-
JWTServiceImpl
public JWTServiceImpl()
-
-
Method Details
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContributionin classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContributionin classDefaultComponent
-
newBuilder
Description copied from interface:JWTServiceCreates a new builder for a JSON Web Token.- Specified by:
newBuilderin interfaceJWTService- Returns:
- the new builder
-
builderWithClaim
-
verifyToken
Description copied from interface:JWTServiceVerifies the token and returns its claims, ornullif the token is invalid (corrupted, constructed from an invalid secret, or expired).The claim
JWTClaims.CLAIM_SUBJECTcontains the token's creator user id.The token hash algorithm is based on a secret provided by the service configuration.
- Specified by:
verifyTokenin interfaceJWTService- Parameters:
token- the token- Returns:
- the claims if the token is valid, or
nullif the token is invalid
-
nodeToValue
Converts aJsonNodeto a Java value. -
getDefaultTTL
protected int getDefaultTTL() -
getAlgorithm
protected com.auth0.jwt.algorithms.Algorithm getAlgorithm()
-