Checking realm role directly

This commit is contained in:
Pedro Igor 2017-04-26 15:39:37 -03:00
parent b78cc63f0d
commit 4e43518b2a

View file

@ -97,7 +97,7 @@ public class AuthorizationTokenService {
KeycloakEvaluationContext evaluationContext = new KeycloakEvaluationContext(this.authorization.getKeycloakSession()); KeycloakEvaluationContext evaluationContext = new KeycloakEvaluationContext(this.authorization.getKeycloakSession());
KeycloakIdentity identity = (KeycloakIdentity) evaluationContext.getIdentity(); KeycloakIdentity identity = (KeycloakIdentity) evaluationContext.getIdentity();
if (!identity.hasRole("uma_authorization")) { if (!identity.hasRealmRole("uma_authorization")) {
throw new ErrorResponseException(OAuthErrorException.INVALID_SCOPE, "Requires uma_authorization scope.", Status.FORBIDDEN); throw new ErrorResponseException(OAuthErrorException.INVALID_SCOPE, "Requires uma_authorization scope.", Status.FORBIDDEN);
} }