mirror of
https://github.com/keycloak/keycloak.git
synced 2025-12-16 20:15:46 -06:00
Do not try to lookup the user if the sub claim is missing from the admin bearer token (#41981)
Closes #41098 Signed-off-by: Pedro Igor <pigor.craveiro@gmail.com>
This commit is contained in:
@@ -297,9 +297,10 @@ public abstract class DefaultKeycloakContext implements KeycloakContext {
|
||||
String issuer = jwt.getIssuer();
|
||||
String realmName = issuer.substring(issuer.lastIndexOf("/") + 1);
|
||||
RealmModel realm = session.realms().getRealmByName(realmName);
|
||||
String id = jwt.getSubject();
|
||||
|
||||
if (realm != null) {
|
||||
user = session.users().getUserById(realm, jwt.getSubject());
|
||||
if (realm != null && id != null) {
|
||||
user = session.users().getUserById(realm, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user