}
public static void onSuccessAdminLogin(HttpSession httpSess, String username, int tenantId,
String tenantDomain, String remoteAddress) throws Exception {
RegistryService registryService = CarbonServicesServiceComponent.getRegistryService();
UserRegistry userRegistry = registryService.getConfigUserRegistry(username, tenantId);
UserRegistry governanceUserRegistry =
registryService.getGovernanceUserRegistry(username, tenantId);
UserRegistry systemRegistry = registryService.getConfigSystemRegistry(tenantId);
UserRegistry governanceRegistry = registryService.getGovernanceSystemRegistry(tenantId);
if (httpSess != null) {
httpSess.setAttribute(ServerConstants.USER_LOGGED_IN, username);
httpSess.setAttribute(RegistryConstants.ROOT_REGISTRY_INSTANCE, registryService
.getRegistry(username, tenantId));
SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(httpSess);
carbonContext.setUsername(username);
carbonContext.setTenantDomain(tenantDomain);