Skip to content

Commit ab6875c

Browse files
author
Thanuja
committed
Fix SessionDataKeyConsent null issue
1 parent 9369b26 commit ab6875c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/validators/DefaultOAuth2ScopeValidator.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public List<String> validateScope(OAuthAuthzReqMessageContext authzReqMessageCon
9595
}
9696
List<String> authorizedScopes = getAuthorizedScopes(requestedScopes, authzReqMessageContext
9797
.getAuthorizationReqDTO().getUser(), appId, null, tenantDomain);
98+
if (requestedScopes.contains(INTERNAL_LOGIN_SCOPE) && !authorizedScopes.contains(INTERNAL_LOGIN_SCOPE)) {
99+
authorizedScopes.add(INTERNAL_LOGIN_SCOPE);
100+
}
98101
removeRegisteredScopes(authzReqMessageContext);
99102
return authorizedScopes;
100103
}
@@ -129,7 +132,11 @@ public List<String> validateScope(OAuthTokenReqMessageContext tokenReqMessageCon
129132
List<String> authorizedScopes = getAuthorizedScopes(requestedScopes, tokenReqMessageContext
130133
.getAuthorizedUser(), appId, grantType, tenantDomain);
131134
removeRegisteredScopes(tokenReqMessageContext);
132-
if (OAuthConstants.GrantTypes.CLIENT_CREDENTIALS.equals(grantType) && authorizedScopes.contains(SYSTEM_SCOPE)) {
135+
if (requestedScopes.contains(INTERNAL_LOGIN_SCOPE) && !authorizedScopes.contains(INTERNAL_LOGIN_SCOPE)) {
136+
authorizedScopes.add(INTERNAL_LOGIN_SCOPE);
137+
}
138+
if (OAuthConstants.GrantTypes.CLIENT_CREDENTIALS.equals(grantType) && authorizedScopes.contains(SYSTEM_SCOPE)
139+
|| authorizedScopes.contains(INTERNAL_LOGIN_SCOPE)) {
133140
authorizedScopes.remove(INTERNAL_LOGIN_SCOPE);
134141
}
135142
return authorizedScopes;

0 commit comments

Comments
 (0)