}
private void onUserLogin(String userName, String tenantDomain, HttpSession httpSess)
throws Exception {
httpSess.setAttribute(ServerConstants.USER_LOGGED_IN, userName);
SuperTenantCarbonContext carbonContext =
SuperTenantCarbonContext.
getCurrentContext(httpSess);
carbonContext.setTenantDomain(tenantDomain);
int tenantId = IdentityRPServiceComponent.getRealmService().getTenantManager().
getTenantId(tenantDomain);
carbonContext.setTenantId(tenantId);
carbonContext.setRegistry(RegistryType.SYSTEM_CONFIGURATION,
IdentityRPServiceComponent.getRegistryService().
getConfigSystemRegistry(tenantId));
carbonContext.setRegistry(RegistryType.USER_CONFIGURATION,
IdentityRPServiceComponent.getRegistryService().
getConfigUserRegistry(userName,
tenantId));
carbonContext.setRegistry(RegistryType.USER_GOVERNANCE,
IdentityRPServiceComponent.getRegistryService().
getGovernanceUserRegistry(userName,
tenantId));
carbonContext.setRegistry(RegistryType.SYSTEM_GOVERNANCE,
IdentityRPServiceComponent.getRegistryService().
getGovernanceSystemRegistry(tenantId));
carbonContext.setUserRealm(IdentityRPServiceComponent.getRegistryService().
getGovernanceUserRegistry(userName,
tenantId).
getUserRealm());
}