public class

JsonWebTokenUtils

extends Object
java.lang.Object
   ↳ com.microstrategy.utils.JsonWebTokenUtils

Class Overview

Class with helper methods to create JWT token and validate it

Summary

Constants
String DEFAULT_ALGORITHM
String PROPERTY_ALGORITHM
String PROPERTY_SECRET_KEY
String PROPERTY_TIME_TO_LIVE
Public Constructors
JsonWebTokenUtils()
Public Methods
static String decryptString(String str)
static String encryptString(String str)
static String generateToken(JsonWebTokenPayLoad payload)
Generate JWT Token with the supplied payload @return
static boolean isValidToken(String compactJws)
Validates if token signature is valid and not expired@return
static void setAlgorithm(String algorithm)
static void setKey(char[] key)
static void setTokenTTL(int tokenTTL)
static JsonWebTokenPayLoad validateToken(String compactJws)
@return
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String DEFAULT_ALGORITHM

Constant Value: "HS256"

public static final String PROPERTY_ALGORITHM

Constant Value: "identityTokenAlgorithm"

public static final String PROPERTY_SECRET_KEY

Constant Value: "identityTokenSecretKey"

public static final String PROPERTY_TIME_TO_LIVE

Constant Value: "identityTokenTimeToLive"

Public Constructors

public JsonWebTokenUtils ()

Public Methods

public static String decryptString (String str)

Throws
GeneralSecurityException
WebUtilsException

public static String encryptString (String str)

Throws
GeneralSecurityException
WebUtilsException

public static String generateToken (JsonWebTokenPayLoad payload)

Generate JWT Token with the supplied payload @return

public static boolean isValidToken (String compactJws)

Validates if token signature is valid and not expired@return

public static void setAlgorithm (String algorithm)

public static void setKey (char[] key)

public static void setTokenTTL (int tokenTTL)

public static JsonWebTokenPayLoad validateToken (String compactJws)

@return

Throws
WebUtilsException Validates if token signature is valid and not expired
ExpiredJwtException
SignatureException