use of org.wso2.carbon.identity.scim2.common.handlers.SCIMClaimOperationEventHandler in project identity-inbound-provisioning-scim2 by wso2-extensions.
the class SCIMCommonComponent method activate.
@Activate
protected void activate(ComponentContext ctx) {
try {
String filePath = IdentityUtil.getIdentityConfigDirPath() + File.separator + SCIMCommonConstants.CHARON_CONFIG_NAME;
SCIMConfigProcessor scimConfigProcessor = SCIMConfigProcessor.getInstance();
scimConfigProcessor.buildConfigFromFile(filePath);
// reading user schema extension
if (Boolean.parseBoolean(scimConfigProcessor.getProperty("user-schema-extension-enabled"))) {
String schemaFilePath = CarbonUtils.getCarbonConfigDirPath() + File.separator + SCIMConfigConstants.SCIM_SCHEMA_EXTENSION_CONFIG;
SCIMUserSchemaExtensionBuilder.getInstance().buildUserSchemaExtension(schemaFilePath);
}
// If custom schema is enabled, read it root attribute URI from the file config if it is configured.
if (SCIMCommonUtils.isCustomSchemaEnabled()) {
SCIMCustomSchemaExtensionBuilder.getInstance().setURI(SCIMCommonUtils.getCustomSchemaURI());
}
// register UserOperationEventListener implementation
SCIMUserOperationListener scimUserOperationListener = new SCIMUserOperationListener();
userOperationEventListenerServiceReg = ctx.getBundleContext().registerService(UserOperationEventListener.class, scimUserOperationListener, null);
// register scimTenantMgtListener implementation
SCIMTenantMgtListener scimTenantMgtListener = new SCIMTenantMgtListener();
tenantMgtListenerServiceReg = ctx.getBundleContext().registerService(TenantMgtListener.class, scimTenantMgtListener, null);
// Register claim operation event handler implementation.
ctx.getBundleContext().registerService(AbstractEventHandler.class.getName(), new SCIMClaimOperationEventHandler(), null);
if (logger.isDebugEnabled()) {
logger.debug("SCIMClaimOperationEventHandler is successfully registered.");
}
// Register default implementation of SCIMUserStoreErrorResolver
ctx.getBundleContext().registerService(SCIMUserStoreErrorResolver.class.getName(), new DefaultSCIMUserStoreErrorResolver(), null);
// Register default implementation of SCIMGroupResolver.
ctx.getBundleContext().registerService(GroupResolver.class.getName(), new SCIMGroupResolver(), null);
// Update super tenant user/group attributes.
AdminAttributeUtil.updateAdminUser(MultitenantConstants.SUPER_TENANT_ID, true);
AdminAttributeUtil.updateAdminGroup(MultitenantConstants.SUPER_TENANT_ID);
if (logger.isDebugEnabled()) {
logger.debug("SCIM Common component activated successfully.");
}
} catch (CharonException e) {
logger.error("Error in reading information from identity tables at SCIMCommonComponentStartup.", e);
} catch (InternalErrorException e) {
logger.error("Error in reading information from identity tables at SCIMCommonComponentStartup.", e);
}
}
Aggregations