public boolean registerGoogleAppsTenant(
TenantInfoBean tenantInfoBean)throws TenantManagementException {
try {
int tenantId = -1;
Tenant tenant = TenantMgtUtil.initializeTenant(tenantInfoBean);
TenantPersistor tenantPersistor = new TenantPersistor();
MultiTenantRealmConfigBuilder builder =
TenantMgtServiceComponent.getRealmService().getMultiTenantRealmConfigBuilder();
TenantMgtConfiguration tenantMgtConfiguration =
TenantMgtServiceComponent.getRealmService().getTenantMgtConfiguration();
RealmConfiguration bootStrapRealmConfig =
TenantMgtServiceComponent.getRealmService().getBootstrapRealmConfiguration();
RealmConfiguration realmConfigToPersist =
builder.getRealmConfigForTenantToPersist(bootStrapRealmConfig,
tenantMgtConfiguration, tenant, -1);
realmConfigToPersist.getUserStoreProperties().put(
UserCoreConstants.RealmConfig.PROPERTY_EXTERNAL_IDP, GOOGLE_APPS_IDP_NAME);
tenant.setRealmConfig(realmConfigToPersist);
tenant.setAdminPassword(UUIDGenerator.getUUID());
tenantId = tenantPersistor.persistTenant(tenant);
tenantInfoBean.setTenantId(tenantId);
TenantMgtUtil.addClaimsToUserStoreManager(tenant);
// Notify tenant addition