Revised code to avoid method invoked twice and double logging

This commit is contained in:
Mauro Mugnaini 2023-07-13 13:06:24 +02:00
parent d5ddbfd067
commit 89c5cf04bd
1 changed files with 3 additions and 2 deletions

View File

@ -299,8 +299,9 @@ public class DefaultKeycloakClient implements KeycloakClient {
params.put(GRANT_TYPE_PARAMETER, Arrays.asList(UMA_TOKEN_GRANT_TYPE));
try {
params.put(AUDIENCE_PARAMETER, Arrays.asList(URLEncoder.encode(checkAudience(audience), "UTF-8")));
logger.trace("audience is {}", checkAudience(audience));
String audienceToSend = URLEncoder.encode(checkAudience(audience), "UTF-8");
params.put(AUDIENCE_PARAMETER, Arrays.asList(audienceToSend));
logger.trace("audience is {}", audienceToSend);
} catch (UnsupportedEncodingException e) {
logger.error("Can't URL encode audience: {}", audience, e);
}