[KEYCLOAK-6814] check if HMAC exists during session restart
This commit is contained in:
parent
92aba77cc1
commit
d40e9bd3c1
1 changed files with 4 additions and 0 deletions
|
@ -154,6 +154,10 @@ public class RestartLoginCookie {
|
||||||
String encodedCookie = cook.getValue();
|
String encodedCookie = cook.getValue();
|
||||||
JWSInput input = new JWSInput(encodedCookie);
|
JWSInput input = new JWSInput(encodedCookie);
|
||||||
SecretKey secretKey = session.keys().getHmacSecretKey(realm, input.getHeader().getKeyId());
|
SecretKey secretKey = session.keys().getHmacSecretKey(realm, input.getHeader().getKeyId());
|
||||||
|
if (secretKey == null) {
|
||||||
|
logger.debug("Failed to retrieve HMAC secret key for session restart");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (!HMACProvider.verify(input, secretKey)) {
|
if (!HMACProvider.verify(input, secretKey)) {
|
||||||
logger.debug("Failed to verify encoded RestartLoginCookie");
|
logger.debug("Failed to verify encoded RestartLoginCookie");
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue