diff --git a/src/main/java/com/amazon/dlic/auth/http/saml/AuthTokenProcessorHandler.java b/src/main/java/com/amazon/dlic/auth/http/saml/AuthTokenProcessorHandler.java index 96afb9131f..d6db0ba8e5 100644 --- a/src/main/java/com/amazon/dlic/auth/http/saml/AuthTokenProcessorHandler.java +++ b/src/main/java/com/amazon/dlic/auth/http/saml/AuthTokenProcessorHandler.java @@ -18,6 +18,7 @@ import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; +import java.util.Base64; import java.util.Date; import java.util.List; import java.util.Optional; @@ -242,7 +243,7 @@ JWK createJwkFromSettings(Settings settings, Settings jwtSettings) throws Except String exchangeKey = settings.get("exchange_key"); if (!Strings.isNullOrEmpty(exchangeKey)) { - exchangeKey = padSecret(exchangeKey, JWSAlgorithm.HS512); + exchangeKey = padSecret(new String(Base64.getDecoder().decode(exchangeKey), StandardCharsets.UTF_8), JWSAlgorithm.HS512); return new OctetSequenceKey.Builder(exchangeKey.getBytes(StandardCharsets.UTF_8)).algorithm(JWSAlgorithm.HS512) .keyUse(KeyUse.SIGNATURE) @@ -256,7 +257,7 @@ JWK createJwkFromSettings(Settings settings, Settings jwtSettings) throws Except ); } - String k = padSecret(jwkSettings.get("k"), JWSAlgorithm.HS512); + String k = padSecret(new String(Base64.getDecoder().decode(jwkSettings.get("k")), StandardCharsets.UTF_8), JWSAlgorithm.HS512); return new OctetSequenceKey.Builder(k.getBytes(StandardCharsets.UTF_8)).algorithm(JWSAlgorithm.HS512) .keyUse(KeyUse.SIGNATURE)