Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat APPLICATION type token requests with organization_switch grant same as CC grant at the scope validator level #2234

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public static class GrantTypes {
public static final String JWT_BEARER = "urn:ietf:params:oauth:grant-type:jwt-bearer";
public static final String REFRESH_TOKEN = "refresh_token";
public static final String DEVICE_CODE = "device_code";
public static final String ORGANIZATION_SWITCH = "organization_switch";

private GrantTypes() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ public List<String> validateScope(OAuthTokenReqMessageContext tokenReqMessageCon
appId = SharedAppResolveDAO.resolveSharedApplication(appResideOrgId, appId, orgId);
}
String grantType = tokenReqMessageContext.getOauth2AccessTokenReqDTO().getGrantType();
/* The APPLICATION type token requests with the organization_switch grant custom grant type will be handled same
as client_credentials grant type when scope validation. */
if (OAuthConstants.GrantTypes.ORGANIZATION_SWITCH.equals(grantType) &&
OAuthConstants.UserType.APPLICATION.equals(
tokenReqMessageContext.getProperty(OAuthConstants.UserType.USER_TYPE))) {
grantType = OAuthConstants.GrantTypes.CLIENT_CREDENTIALS;
}
List<String> authorizedScopes = getAuthorizedScopes(requestedScopes, tokenReqMessageContext
.getAuthorizedUser(), appId, grantType, tenantDomain);
removeRegisteredScopes(tokenReqMessageContext);
Expand Down
Loading