Fix migration test

Closes #9550
This commit is contained in:
mposolda 2022-01-20 09:35:33 +01:00 committed by Marek Posolda
parent 2877482e40
commit 3dd97f3f2f
2 changed files with 8 additions and 1 deletions

View file

@ -17,8 +17,10 @@
package org.keycloak.authentication;
import org.keycloak.models.AuthenticatedClientSessionModel;
import org.keycloak.models.Constants;
import org.keycloak.sessions.AuthenticationSessionModel;
import org.keycloak.sessions.CommonClientSessionModel;
public class AuthenticatorUtil {
@ -40,4 +42,9 @@ public class AuthenticatorUtil {
return AuthenticatorUtil.getRequestedLevelOfAuthentication(authSession)
<= AuthenticatorUtil.getCurrentLevelOfAuthentication(authSession);
}
public static int getCurrentLevelOfAuthentication(AuthenticatedClientSessionModel clientSession) {
String clientSessionLoaNote = clientSession.getNote(Constants.LEVEL_OF_AUTHENTICATION);
return clientSessionLoaNote == null ? Constants.NO_LOA : Integer.parseInt(clientSessionLoaNote);
}
}

View file

@ -854,7 +854,7 @@ public class TokenManager {
}
private String getAcr(AuthenticatedClientSessionModel clientSession) {
int loa = Integer.parseInt(clientSession.getNote(Constants.LEVEL_OF_AUTHENTICATION));
int loa = AuthenticatorUtil.getCurrentLevelOfAuthentication(clientSession);
if (loa < Constants.MINIMUM_LOA) {
loa = AuthenticationManager.isSSOAuthentication(clientSession) ? 0 : 1;
}