public class JWTUtil extends Object
| Constructor and Description |
|---|
JWTUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildBase64JWT(Map<String,String> mapClaims,
Date expirationDate,
String strAlgo,
Key key)
Check the signature of the JWT with a secret key
|
static boolean |
checkPayloadValues(javax.servlet.http.HttpServletRequest request,
String strHeaderName,
Map<String,String> claimsToCheck)
Checks claims key/value inside the JWT payload
|
static boolean |
checkSignature(javax.servlet.http.HttpServletRequest request,
String strHeaderName,
Key key)
Check the JWT signature with provided java security Key: this can be a RSA Public Key
|
static boolean |
checkSignature(String strBase64JWT,
Key key)
Check a JWT signature with a Java security Key
|
static boolean |
containsValidUnsafeJWT(javax.servlet.http.HttpServletRequest request,
String strHeaderName)
Check if provided request contains a JWT
|
static Key |
getKey(String strSecretKey,
String strAlgoName)
Get a java security Key from a String secreyKey and algorythm name
|
static String |
getPayloadValue(javax.servlet.http.HttpServletRequest request,
String strHeaderName,
String strClaimName)
Get a payload value with given claimName;
|
static String |
getPayloadValue(String strBase64JWT,
String strClaimName)
Get a payload value with given claimName;
|
public static boolean containsValidUnsafeJWT(javax.servlet.http.HttpServletRequest request,
String strHeaderName)
request - strHeaderName - public static boolean checkPayloadValues(javax.servlet.http.HttpServletRequest request,
String strHeaderName,
Map<String,String> claimsToCheck)
request - strHeaderName - claimsToCheck - public static String getPayloadValue(javax.servlet.http.HttpServletRequest request, String strHeaderName, String strClaimName)
request - strHeaderName - strClaimName - public static String getPayloadValue(String strBase64JWT, String strClaimName)
strBase64JWT - strClaimName - public static boolean checkSignature(javax.servlet.http.HttpServletRequest request,
String strHeaderName,
Key key)
request - The requeststrHeaderName - The header namekey - The keypublic static String buildBase64JWT(Map<String,String> mapClaims, Date expirationDate, String strAlgo, Key key)
mapClaims - The map of claimsexpirationDate - The expiration datestrAlgo - The algorythm namekey - The keypublic static Key getKey(String strSecretKey, String strAlgoName)
strSecretKey - The secret KeystrAlgoName - The algorythm nameCopyright © 2021 City of Paris. All rights reserved.