Skip to content

Commit

Permalink
Merge pull request #2742 from Thisara-Welmilla/change-org-in-event
Browse files Browse the repository at this point in the history
Remove Organization in pre-issue access token Request.
  • Loading branch information
malithie authored Mar 11, 2025
2 parents 07d921a + 117ba12 commit 05189c2
Showing 1 changed file with 0 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.wso2.carbon.identity.action.execution.api.model.Event;
import org.wso2.carbon.identity.action.execution.api.model.FlowContext;
import org.wso2.carbon.identity.action.execution.api.model.Operation;
import org.wso2.carbon.identity.action.execution.api.model.Organization;
import org.wso2.carbon.identity.action.execution.api.model.Request;
import org.wso2.carbon.identity.action.execution.api.model.Tenant;
import org.wso2.carbon.identity.action.execution.api.model.User;
Expand All @@ -45,7 +44,6 @@
import org.wso2.carbon.identity.oauth.common.exception.InvalidOAuthClientException;
import org.wso2.carbon.identity.oauth.config.OAuthServerConfiguration;
import org.wso2.carbon.identity.oauth.dao.OAuthAppDO;
import org.wso2.carbon.identity.oauth.internal.OAuthComponentServiceHolder;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;
import org.wso2.carbon.identity.oauth2.dto.OAuth2AccessTokenReqDTO;
import org.wso2.carbon.identity.oauth2.model.HttpRequestHeader;
Expand All @@ -56,7 +54,6 @@
import org.wso2.carbon.identity.openidconnect.CustomClaimsCallbackHandler;
import org.wso2.carbon.identity.openidconnect.OIDCClaimUtil;
import org.wso2.carbon.identity.openidconnect.util.ClaimHandlerUtil;
import org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementException;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -112,8 +109,6 @@ private Event getEvent(OAuthTokenReqMessageContext tokenMessageContext, Map<Stri
boolean isAuthorizedForUser = isAccessTokenAuthorizedForUser(tokenReqDTO.getGrantType(), tokenMessageContext);
if (isAuthorizedForUser) {
setUserForEventBuilder(eventBuilder, authorizedUser, tokenReqDTO.getClientId(), tokenReqDTO.getGrantType());
setOrganizationForEventBuilder(eventBuilder, authorizedUser, tokenReqDTO.getClientId(),
tokenReqDTO.getGrantType());
eventBuilder.userStore(new UserStore(authorizedUser.getUserStoreDomain()));
}

Expand All @@ -139,26 +134,6 @@ private void setUserForEventBuilder(PreIssueAccessTokenEvent.Builder eventBuilde
}
}

private void setOrganizationForEventBuilder(PreIssueAccessTokenEvent.Builder eventBuilder, AuthenticatedUser user,
String clientID, String grantType) {

try {
String organizationId = user.getUserResidentOrganization();
if (organizationId != null && !organizationId.isEmpty()) {
String organizationName = OAuthComponentServiceHolder.getInstance().getOrganizationManager()
.getOrganizationNameById(user.getUserResidentOrganization());
eventBuilder.organization(new Organization(user.getUserResidentOrganization(),
organizationName));
}
} catch (OrganizationManagementException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(String.format(
"Error occurred while retrieving organization name of the authorized user for application: " +
clientID + "for grantType: " + grantType), e);
}
}
}

private Request getRequest(OAuth2AccessTokenReqDTO tokenRequestDTO) {

TokenRequest.Builder tokenRequestBuilder = new TokenRequest.Builder();
Expand Down

0 comments on commit 05189c2

Please sign in to comment.