throws Exception {
// get the system registry for the tenant
RealmConfiguration realmConfig = TenantMgtServiceComponent.getBootstrapRealmConfiguration();
TenantMgtConfiguration tenantMgtConfiguration =
TenantMgtServiceComponent.getRealmService().getTenantMgtConfiguration();
UserRealm userRealm;
try {
MultiTenantRealmConfigBuilder builder =
TenantMgtServiceComponent.getRealmService().
getMultiTenantRealmConfigBuilder();
RealmConfiguration realmConfigToPersist =
builder.getRealmConfigForTenantToPersist(realmConfig, tenantMgtConfiguration,
tenant,
tenantId);
RealmConfiguration realmConfigToCreate =
builder.
getRealmConfigForTenantToCreateRealmOnTenantCreation(realmConfig,
realmConfigToPersist,
tenantId);
userRealm =
TenantMgtServiceComponent.getRealmService().
getUserRealm(realmConfigToCreate);
} catch (UserStoreException e) {
String msg = "Error in creating Realm for tenant, tenant domain: " + tenant.getDomain();
log.error(msg, e);
throw new Exception(msg, e);
}
UserStoreManager userStoreManager;
try {
userStoreManager = userRealm.getUserStoreManager();
return userStoreManager;
} catch (UserStoreException e) {
String msg = "Error in getting the userstore/authorization manager for tenant: " +
tenant.getDomain();