Skip to end of metadata
Go to start of metadata

Refresh page May 26, 2020 13:06

Supported Clients
SmartClient WebClient NGClient

Methods Summary
String create(payload) Create a JSON Web Token for the given payload that is signed with the (shared) secret key 'jwt.
String create(payload, expiresAt) Create a JSON Web Token for the given payload that is signed with the (shared) secret key 'jwt.
Object verify(token) Verifiy a token that is created with the #create(Object) method.

Methods Details

create(payload)

Create a JSON Web Token for the given payload that is signed with the (shared) secret key 'jwt.secret.password' that has to be configured on the admin page for this plugin.
The payload can be for example a user:username of the current user, so that with this token if it verifies with the same secret key you can assume it is the same user that wants to login.

Parameters

Object payload a json containing the data, e.g. {'some': 'data', 'somemore': 'data2'}

Returns

String a string representing the encrypted data or null if the token cannot be generated

Supported Clients

SmartClient,WebClient,NGClient

Sample

 

create(payload, expiresAt)

Create a JSON Web Token for the given payload that is signed with the (shared) secret key 'jwt.secret.password' that has to be configured on the admin page for this plugin.
The payload can be for example a user:username of the current user, so that with this token if it verifies with the same secret key you can assume it is the same user that wants to login.
The expiresAt makes sure this token is only valid until that date.

Parameters

Object payload a json containing the data, e.g. {'some': 'data', 'somemore': 'data2'}
Date expiresAt the date when the created token expires, after the expired date the token won't be verified

Returns

String a string representing the encrypted data or null if the token cannot be generated

Supported Clients

SmartClient,WebClient,NGClient

Sample

 

verify(token)

Verifiy a token that is created with the #create(Object) method.
This will only verify and return the payload that was given if the token could be verified with the (shared) secrect key 'jwt.secret.password' that is configured on the admin page.
Will also return null if the token passed its expire date.

Parameters

String token a JSON Web Token

Returns

Object the payload or null if the token can't be verified

Supported Clients

SmartClient,WebClient,NGClient

Sample

 

  • No labels