Skip to content

Commit

Permalink
Set authenticated user information in the organization bound tenanted…
Browse files Browse the repository at this point in the history
… context
  • Loading branch information
sadilchamishka committed Oct 27, 2023
1 parent e10a03a commit 404cb05
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,16 @@ private boolean isAuthorizationSkipped(String authHandlerName, String requestUri

private void startOrganizationBoundTenantFlow(String authorizedOrganization) {

String userId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserId();
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setOrganizationId(authorizedOrganization);
try {
String authorizedTenantDomain = AuthorizationValveServiceHolder.getInstance().getOrganizationManager()
.resolveTenantDomain(authorizedOrganization);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(authorizedTenantDomain, true);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUserId(userId);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(userName);
} catch (OrganizationManagementException e) {
throw new AuthRuntimeException("Error while resolving tenant domain by organization.", e);
}
Expand Down

0 comments on commit 404cb05

Please sign in to comment.