Added JTI value getter and essentials info dump in JWT

This commit is contained in:
Mauro Mugnaini 2021-01-20 00:57:49 +01:00
parent 200d47bb6a
commit 8dc8f1d2a7
1 changed files with 8 additions and 1 deletions

View File

@ -31,7 +31,6 @@ public class JWTToken implements Serializable {
public static JWTToken fromString(String tokenString) {
if (tokenString == null) {
// logger.trace("Token string is null, cannot create token object");
return null;
}
try {
@ -118,6 +117,10 @@ public class JWTToken implements Serializable {
return audienceStrings;
}
public String getJti() {
return (String) getPayload().get("jti");
}
public String getSub() {
return (String) getPayload().get("sub");
}
@ -219,4 +222,8 @@ public class JWTToken implements Serializable {
return getRaw();
}
public String getTokenEssentials() {
return "[" + getJti() + "] issued for user " + getUserName() + " (" + getSub() + ") in " + getAzp()
+ ", expiry at: " + getExpAsDate() + " with audience: " + getAud();
}
}