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

draft #350

Closed
Closed

draft #350

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 @@ -26,6 +26,7 @@
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants;
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
import org.wso2.carbon.identity.application.common.model.AssociatedRolesConfig;
import org.wso2.carbon.identity.application.common.model.AuthenticationStep;
import org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig;
import org.wso2.carbon.identity.application.common.model.IdentityProvider;
Expand Down Expand Up @@ -809,6 +810,9 @@ private ServiceProvider prepareSharedApplication(ServiceProvider mainApplication
FrameworkConstants.Application.MY_ACCOUNT_APP_PATH));
}
appendFragmentAppProperties(delegatedApplication);
delegatedApplication.setAssociatedRolesConfig(new AssociatedRolesConfig());
delegatedApplication.getAssociatedRolesConfig()
.setAllowedAudience(mainApplication.getAssociatedRolesConfig().getAllowedAudience());

return delegatedApplication;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ public void handleEvent(Event event) throws IdentityEventException {
orgId = (String) eventProperties.get(EVENT_PROP_ORGANIZATION_ID);
String tenantDomain = OrganizationUserSharingDataHolder.getInstance().getOrganizationManager()
.resolveTenantDomain(orgId);
if (!OrganizationManagementUtil.isOrganization(tenantDomain)) {
return;
}

RealmConfiguration realmConfiguration = OrganizationUserSharingDataHolder.getInstance()
.getRealmService().getTenantUserRealm(IdentityTenantUtil.getTenantId(tenantDomain))
Expand All @@ -129,7 +126,7 @@ public void handleEvent(Event event) throws IdentityEventException {
String userId = userSharingService
.getUserAssociationOfAssociatedUserByOrgId(associatedUserId, orgId)
.getUserId();
if (isAuthenticatedFromConsoleApp()) {
if (!isAuthenticatedFromB2BApp()) {
assignUserToConsoleAppAdminRole(userId, tenantDomain);
}
} finally {
Expand All @@ -143,15 +140,15 @@ public void handleEvent(Event event) throws IdentityEventException {
}
}

private boolean isAuthenticatedFromConsoleApp() {
private boolean isAuthenticatedFromB2BApp() {

Object authenticatedAppFromThreadLocal = IdentityUtil.threadLocalProperties.get()
.get(FrameworkConstants.SERVICE_PROVIDER);
if (!(authenticatedAppFromThreadLocal instanceof String)) {
return false;
}
String authenticatedApp = (String) authenticatedAppFromThreadLocal;
return FrameworkConstants.Application.CONSOLE_APP.equals(authenticatedApp);
return !FrameworkConstants.Application.CONSOLE_APP.equals(authenticatedApp);
}

private Role buildOrgCreatorRole(String adminUUID) {
Expand Down
Loading