Helper function to crete a `RefreshToken` object from its base64 encoded JWT string added
This commit is contained in:
parent
f7ab942a5c
commit
defc33913f
|
@ -75,7 +75,11 @@ public class ModelUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RefreshToken getRefreshTokenFrom(TokenResponse tokenResponse) throws Exception {
|
public static RefreshToken getRefreshTokenFrom(TokenResponse tokenResponse) throws Exception {
|
||||||
return getRefreshTokenFrom(tokenResponse, RefreshToken.class);
|
return getRefreshTokenFrom(tokenResponse.getRefreshToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static RefreshToken getRefreshTokenFrom(String base64EncodedJWT) throws Exception {
|
||||||
|
return mapper.readValue(getDecodedPayload(base64EncodedJWT), RefreshToken.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <T> T getRefreshTokenFrom(TokenResponse tokenResponse, Class<T> clazz) throws Exception {
|
private static <T> T getRefreshTokenFrom(TokenResponse tokenResponse, Class<T> clazz) throws Exception {
|
||||||
|
@ -124,7 +128,7 @@ public class ModelUtils {
|
||||||
logger.debug("Client id not provided, using authorized party field (azp)");
|
logger.debug("Client id not provided, using authorized party field (azp)");
|
||||||
clientId = accessToken.getIssuedFor();
|
clientId = accessToken.getIssuedFor();
|
||||||
if (clientId == null) {
|
if (clientId == null) {
|
||||||
logger.debug("Issued for field (azp) not present, getting first of the audience field (aud)");
|
logger.warn("Issued for field (azp) not present, getting first of the audience field (aud)");
|
||||||
clientId = getFirstAudienceNoAccount(accessToken);
|
clientId = getFirstAudienceNoAccount(accessToken);
|
||||||
}
|
}
|
||||||
return clientId;
|
return clientId;
|
||||||
|
|
Loading…
Reference in New Issue