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 TypeClassDescriptionclass
Implementation ofJWTService.JWTBuilder
delegating to the auth0 JWT library.Nested classes/interfaces inherited from interface org.nuxeo.ecm.jwt.JWTService
JWTService.JWTBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
protected static final com.fasterxml.jackson.databind.ObjectMapper
protected JWTServiceConfigurationDescriptor
static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.auth0.jwt.algorithms.Algorithm
protected int
Creates a new builder for a JSON Web Token.protected static Object
nodeToValue
(com.fasterxml.jackson.databind.JsonNode node) Converts aJsonNode
to a Java value.void
start
(ComponentContext context) Start the component.void
stop
(ComponentContext context) Stop the component.verifyToken
(String token) Verifies the token and returns its claims, ornull
if 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, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
-
serviceConfiguration
-
-
Constructor Details
-
JWTServiceImpl
public JWTServiceImpl()
-
-
Method Details
-
start
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
stop
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
-
newBuilder
Description copied from interface:JWTService
Creates a new builder for a JSON Web Token.- Specified by:
newBuilder
in interfaceJWTService
- Returns:
- the new builder
-
verifyToken
Description copied from interface:JWTService
Verifies the token and returns its claims, ornull
if the token is invalid (corrupted, constructed from an invalid secret, or expired).The claim
JWTClaims.CLAIM_SUBJECT
contains the token's creator user id.The token hash algorithm is based on a secret provided by the service configuration.
- Specified by:
verifyToken
in interfaceJWTService
- Parameters:
token
- the token- Returns:
- the claims if the token is valid, or
null
if the token is invalid
-
nodeToValue
Converts aJsonNode
to a Java value. -
getDefaultTTL
protected int getDefaultTTL() -
getAlgorithm
protected com.auth0.jwt.algorithms.Algorithm getAlgorithm()
-