Helper function to crete a `RefreshToken` object from its base64 encoded JWT string added

This commit is contained in:
Mauro Mugnaini 2021-12-17 17:58:22 +01:00
parent f7ab942a5c
commit defc33913f
1 changed files with 6 additions and 2 deletions

View File

@ -75,7 +75,11 @@ public class ModelUtils {
}
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 {
@ -124,7 +128,7 @@ public class ModelUtils {
logger.debug("Client id not provided, using authorized party field (azp)");
clientId = accessToken.getIssuedFor();
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);
}
return clientId;