Added JTI value getter and essentials info dump in JWT
This commit is contained in:
parent
200d47bb6a
commit
8dc8f1d2a7
|
@ -31,7 +31,6 @@ public class JWTToken implements Serializable {
|
||||||
|
|
||||||
public static JWTToken fromString(String tokenString) {
|
public static JWTToken fromString(String tokenString) {
|
||||||
if (tokenString == null) {
|
if (tokenString == null) {
|
||||||
// logger.trace("Token string is null, cannot create token object");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -118,6 +117,10 @@ public class JWTToken implements Serializable {
|
||||||
return audienceStrings;
|
return audienceStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getJti() {
|
||||||
|
return (String) getPayload().get("jti");
|
||||||
|
}
|
||||||
|
|
||||||
public String getSub() {
|
public String getSub() {
|
||||||
return (String) getPayload().get("sub");
|
return (String) getPayload().get("sub");
|
||||||
}
|
}
|
||||||
|
@ -219,4 +222,8 @@ public class JWTToken implements Serializable {
|
||||||
return getRaw();
|
return getRaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTokenEssentials() {
|
||||||
|
return "[" + getJti() + "] issued for user " + getUserName() + " (" + getSub() + ") in " + getAzp()
|
||||||
|
+ ", expiry at: " + getExpAsDate() + " with audience: " + getAud();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue