.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
HttpSession httpSession = request.getSession(false);
String userName = DBUtils.getUsername(msgContext);
RealmService realmService = DataServicesDSComponent.getRealmService();
RegistryService registryService = DataServicesDSComponent.getRegistryService();
/* if session does not exist, return empty array of roles */
if (httpSession == null) {
return new String[0];
}
/* first return the tenant id from the tenant domain */
SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(httpSession);
String tenantDomain = carbonContext.getTenantDomain();
int tenantId = carbonContext.getTenantId();
if (tenantId < 0) {
tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
}
if (tenantId < 0) {
/* the tenant doesn't exist. */
log.error("The tenant doesn't exist. Tenant domain:" + tenantDomain);
throw new DataServiceFault("Access Denied. You are not authorized.");
}
if (!realmService.getTenantManager().isTenantActive(tenantId)) {
/* the tenant is not active. */
log.error("The tenant is not active. Tenant domain:" + tenantDomain);
throw new DataServiceFault("The tenant is not active. Tenant domain:" + tenantDomain);
}
UserRealm realm;