use of org.wso2.carbon.identity.mgt.listener.TenantManagementListener in project carbon-identity-framework by wso2.
the class IdPManagementServiceComponent method activate.
@Activate
protected void activate(ComponentContext ctxt) {
try {
BundleContext bundleCtx = ctxt.getBundleContext();
TenantManagementListener idPMgtTenantMgtListener = new TenantManagementListener();
ServiceRegistration tenantMgtListenerSR = bundleCtx.registerService(TenantMgtListener.class.getName(), idPMgtTenantMgtListener, null);
if (tenantMgtListenerSR != null) {
log.debug("Identity Provider Management - TenantMgtListener registered");
} else {
log.error("Identity Provider Management - TenantMgtListener could not be registered");
}
ServiceRegistration userOperationListenerSR = bundleCtx.registerService(UserOperationEventListener.class.getName(), new UserStoreListener(), null);
if (userOperationListenerSR != null) {
log.debug("Identity Provider Management - UserOperationEventListener registered");
} else {
log.error("Identity Provider Management - UserOperationEventListener could not be registered");
}
ServiceRegistration auditLoggerSR = bundleCtx.registerService(IdentityProviderMgtListener.class.getName(), new IDPMgtAuditLogger(), null);
if (auditLoggerSR != null) {
log.debug("Identity Provider Management - Audit Logger registered");
} else {
log.error("Identity Provider Management - Error while registering Audit Logger");
}
ServiceRegistration idPNameResolverListener = bundleCtx.registerService(IdentityProviderMgtListener.class.getName(), new IdentityProviderNameResolverListener(), null);
if (idPNameResolverListener != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Provider Name Resolver Listener registered.");
}
} else {
log.error("Identity Provider Management - Error while registering Identity Provider Name Resolver " + "Listener.");
}
setIdentityProviderMgtListenerService(new IdPMgtValidationListener());
CacheBackedIdPMgtDAO dao = new CacheBackedIdPMgtDAO(new IdPManagementDAO());
if (dao.getIdPByName(null, IdentityApplicationConstants.RESIDENT_IDP_RESERVED_NAME, IdentityTenantUtil.getTenantId(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME), MultitenantConstants.SUPER_TENANT_DOMAIN_NAME) == null) {
addSuperTenantIdp();
}
bundleCtx.registerService(IdpManager.class, IdentityProviderManager.getInstance(), null);
ServiceRegistration idpClaimMetadataMgtListener = bundleCtx.registerService(ClaimMetadataMgtListener.class.getName(), new IdentityProviderClaimMgtListener(), null);
if (idpClaimMetadataMgtListener != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Provider Claim Metadata Management Listener registered.");
}
} else {
log.error("Identity Provider Management - Error while registering Identity Provider Claim Metadata " + "Management Listener.");
}
buildFileBasedIdPList();
cleanUpRemovedIdps();
log.debug("Identity Provider Management bundle is activated");
} catch (Throwable e) {
log.error("Error while activating Identity Provider Management bundle", e);
}
}
use of org.wso2.carbon.identity.mgt.listener.TenantManagementListener in project carbon-identity-framework by wso2.
the class IdentityMgtServiceComponent method activate.
@Activate
protected void activate(ComponentContext context) {
Dictionary<String, String> props = new Hashtable<String, String>();
props.put(CarbonConstants.AXIS2_CONFIG_SERVICE, AxisObserver.class.getName());
context.getBundleContext().registerService(AxisObserver.class.getName(), new IdentityMgtDeploymentInterceptor(), props);
init();
if (log.isDebugEnabled()) {
log.debug("Identity Management Listener is enabled");
}
ServiceRegistration serviceRegistration = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityMgtEventListener(), null);
if (serviceRegistration != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - UserOperationEventListener registered.");
}
} else {
log.error("Identity Management - UserOperationEventListener could not be registered.");
}
UserOperationsNotificationListener notificationListener = new UserOperationsNotificationListener();
ServiceRegistration userOperationNotificationSR = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), notificationListener, null);
context.getBundleContext().registerService(TenantMgtListener.class.getName(), new TenantManagementListener(), null);
context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new UserSessionTerminationListener(), null);
if (userOperationNotificationSR != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - UserOperationNotificationListener registered.");
}
} else {
log.error("Identity Management - UserOperationNotificationListener could not be registered.");
}
ServiceRegistration identityUserIdResolverListener = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityUserIdResolverListener(), null);
if (identityUserIdResolverListener != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - IdentityUserIdResolverListener registered.");
}
} else {
log.error("Identity Management - IdentityUserIdResolverListener could not be registered.");
}
ServiceRegistration identityUserNameResolverListener = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), new IdentityUserNameResolverListener(), null);
if (identityUserNameResolverListener != null) {
if (log.isDebugEnabled()) {
log.debug("Identity Management - IdentityUserNameResolverListener registered.");
}
} else {
log.error("Identity Management - IdentityUserNameResolverListener could not be registered.");
}
if (log.isDebugEnabled()) {
log.debug("Identity Management bundle is activated");
}
RegistryCleanUpService registryCleanUpService = new RegistryCleanUpService(IdentityMgtConfig.getInstance().getRegistryCleanUpPeriod(), IdentityMgtConfig.getInstance().getRegistryCleanUpPeriod());
registryCleanUpService.activateCleanUp();
// Set user session mapping enabled.
IdentityMgtServiceDataHolder.getInstance().setUserSessionMappingEnabled(FrameworkUtils.isUserSessionMappingEnabled());
}
use of org.wso2.carbon.identity.mgt.listener.TenantManagementListener in project identity-governance by wso2-extensions.
the class IdentityRecoveryServiceComponent method activate.
@Activate
protected void activate(ComponentContext context) {
try {
BundleContext bundleContext = context.getBundleContext();
bundleContext.registerService(NotificationPasswordRecoveryManager.class.getName(), NotificationPasswordRecoveryManager.getInstance(), null);
bundleContext.registerService(SecurityQuestionPasswordRecoveryManager.class.getName(), SecurityQuestionPasswordRecoveryManager.getInstance(), null);
bundleContext.registerService(NotificationUsernameRecoveryManager.class.getName(), NotificationUsernameRecoveryManager.getInstance(), null);
bundleContext.registerService(UserSelfRegistrationManager.class.getName(), UserSelfRegistrationManager.getInstance(), null);
bundleContext.registerService(ChallengeQuestionManager.class.getName(), ChallengeQuestionManager.getInstance(), null);
bundleContext.registerService(ResendConfirmationManager.class.getName(), ResendConfirmationManager.getInstance(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new AccountConfirmationValidationHandler(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new UserSelfRegistrationHandler(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new LiteUserRegistrationHandler(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new UserEmailVerificationHandler(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new MobileNumberVerificationHandler(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new AdminForcedPasswordResetHandler(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new TenantRegistrationVerificationHandler(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new IdentityUserMetadataMgtHandler(), null);
bundleContext.registerService(IdentityConnectorConfig.class.getName(), new RecoveryConfigImpl(), null);
bundleContext.registerService(IdentityConnectorConfig.class.getName(), new SelfRegistrationConfigImpl(), null);
bundleContext.registerService(IdentityConnectorConfig.class.getName(), new LiteRegistrationConfigImpl(), null);
bundleContext.registerService(IdentityConnectorConfig.class.getName(), new UserEmailVerificationConfigImpl(), null);
bundleContext.registerService(IdentityConnectorConfig.class.getName(), new UserClaimUpdateConfigImpl(), null);
bundleContext.registerService(IdentityConnectorConfig.class.getName(), new AdminForcedPasswordResetConfigImpl(), null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new CodeInvalidationHandler(), null);
UsernameRecoveryManager usernameRecoveryManager = new UsernameRecoveryManagerImpl();
bundleContext.registerService(UsernameRecoveryManager.class.getName(), usernameRecoveryManager, null);
PasswordRecoveryManager passwordRecoveryManager = new PasswordRecoveryManagerImpl();
bundleContext.registerService(PasswordRecoveryManager.class.getName(), passwordRecoveryManager, null);
// Registering missing challenge question handler as a post authn handler
PostAuthenticationHandler postAuthnMissingChallengeQuestions = PostAuthnMissingChallengeQuestionsHandler.getInstance();
bundleContext.registerService(PostAuthenticationHandler.class.getName(), postAuthnMissingChallengeQuestions, null);
bundleContext.registerService(AbstractEventHandler.class.getName(), new ChallengeAnswerValidationHandler(), null);
} catch (Exception e) {
log.error("Error while activating identity governance component.", e);
}
// register the tenant management listener
TenantMgtListener tenantMgtListener = new TenantManagementListener();
context.getBundleContext().registerService(TenantMgtListener.class.getName(), tenantMgtListener, null);
// register default challenge questions
try {
if (log.isDebugEnabled()) {
log.debug("Loading default challenge questions for super tenant.");
}
loadDefaultChallengeQuestions();
// new ChallengeQuestionManager().getAllChallengeQuestions("carbon.super", "lk_LK");
} catch (IdentityRecoveryException e) {
log.error("Error persisting challenge question for super tenant.", e);
}
}
Aggregations