use of org.wso2.carbon.registry.core.service.RegistryService in project jaggery by wso2.
the class RegistryHostObject method getRegistry.
private static UserRegistry getRegistry(String username, String password) throws ScriptException {
UserRegistry registry;
RegistryService registryService = RegistryHostObjectContext.getRegistryService();
String tDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(false);
try {
int tId = RegistryHostObjectContext.getRealmService().getTenantManager().getTenantId(tDomain);
registry = registryService.getGovernanceUserRegistry(username, password, tId);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new ScriptException(e);
}
if (registry == null) {
String msg = "User governance registry cannot be retrieved";
throw new ScriptException(msg);
}
return registry;
}
Aggregations