Search in sources :

Example 1 with TenantManagementListener

use of org.wso2.carbon.identity.recovery.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);
    }
}
Also used : IdentityProviderNameResolverListener(org.wso2.carbon.idp.mgt.listener.IdentityProviderNameResolverListener) UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) CacheBackedIdPMgtDAO(org.wso2.carbon.idp.mgt.dao.CacheBackedIdPMgtDAO) IdPManagementDAO(org.wso2.carbon.idp.mgt.dao.IdPManagementDAO) IdentityProviderMgtListener(org.wso2.carbon.idp.mgt.listener.IdentityProviderMgtListener) ClaimMetadataMgtListener(org.wso2.carbon.identity.claim.metadata.mgt.listener.ClaimMetadataMgtListener) TenantMgtListener(org.wso2.carbon.stratos.common.listeners.TenantMgtListener) IdentityProviderClaimMgtListener(org.wso2.carbon.idp.mgt.listener.IdentityProviderClaimMgtListener) IDPMgtAuditLogger(org.wso2.carbon.idp.mgt.listener.IDPMgtAuditLogger) IdPMgtValidationListener(org.wso2.carbon.idp.mgt.listener.IdPMgtValidationListener) BundleContext(org.osgi.framework.BundleContext) ServiceRegistration(org.osgi.framework.ServiceRegistration) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with TenantManagementListener

use of org.wso2.carbon.identity.recovery.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());
}
Also used : TenantManagementListener(org.wso2.carbon.identity.mgt.listener.TenantManagementListener) UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UserSessionTerminationListener(org.wso2.carbon.identity.mgt.listener.UserSessionTerminationListener) IdentityUserIdResolverListener(org.wso2.carbon.identity.mgt.listener.IdentityUserIdResolverListener) Hashtable(java.util.Hashtable) TenantMgtListener(org.wso2.carbon.stratos.common.listeners.TenantMgtListener) UserOperationsNotificationListener(org.wso2.carbon.identity.mgt.listener.UserOperationsNotificationListener) IdentityMgtEventListener(org.wso2.carbon.identity.mgt.IdentityMgtEventListener) IdentityUserNameResolverListener(org.wso2.carbon.identity.mgt.listener.IdentityUserNameResolverListener) AxisObserver(org.apache.axis2.engine.AxisObserver) ServiceRegistration(org.osgi.framework.ServiceRegistration) RegistryCleanUpService(org.wso2.carbon.identity.mgt.store.RegistryCleanUpService) Activate(org.osgi.service.component.annotations.Activate)

Example 3 with TenantManagementListener

use of org.wso2.carbon.identity.recovery.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);
    }
}
Also used : NotificationPasswordRecoveryManager(org.wso2.carbon.identity.recovery.password.NotificationPasswordRecoveryManager) TenantManagementListener(org.wso2.carbon.identity.recovery.listener.TenantManagementListener) UsernameRecoveryManagerImpl(org.wso2.carbon.identity.recovery.internal.service.impl.username.UsernameRecoveryManagerImpl) UserSelfRegistrationManager(org.wso2.carbon.identity.recovery.signup.UserSelfRegistrationManager) IdentityUserMetadataMgtHandler(org.wso2.carbon.identity.recovery.handler.IdentityUserMetadataMgtHandler) NotificationUsernameRecoveryManager(org.wso2.carbon.identity.recovery.username.NotificationUsernameRecoveryManager) ResendConfirmationManager(org.wso2.carbon.identity.recovery.confirmation.ResendConfirmationManager) SecurityQuestionPasswordRecoveryManager(org.wso2.carbon.identity.recovery.password.SecurityQuestionPasswordRecoveryManager) LiteRegistrationConfigImpl(org.wso2.carbon.identity.recovery.connector.LiteRegistrationConfigImpl) TenantMgtListener(org.wso2.carbon.stratos.common.listeners.TenantMgtListener) AdminForcedPasswordResetHandler(org.wso2.carbon.identity.recovery.handler.AdminForcedPasswordResetHandler) IdentityConnectorConfig(org.wso2.carbon.identity.governance.common.IdentityConnectorConfig) ChallengeAnswerValidationHandler(org.wso2.carbon.identity.recovery.handler.ChallengeAnswerValidationHandler) AccountConfirmationValidationHandler(org.wso2.carbon.identity.recovery.handler.AccountConfirmationValidationHandler) NotificationUsernameRecoveryManager(org.wso2.carbon.identity.recovery.username.NotificationUsernameRecoveryManager) UsernameRecoveryManager(org.wso2.carbon.identity.recovery.services.username.UsernameRecoveryManager) TenantRegistrationVerificationHandler(org.wso2.carbon.identity.recovery.handler.TenantRegistrationVerificationHandler) RecoveryConfigImpl(org.wso2.carbon.identity.recovery.connector.RecoveryConfigImpl) CodeInvalidationHandler(org.wso2.carbon.identity.recovery.handler.CodeInvalidationHandler) UserEmailVerificationHandler(org.wso2.carbon.identity.recovery.handler.UserEmailVerificationHandler) MobileNumberVerificationHandler(org.wso2.carbon.identity.recovery.handler.MobileNumberVerificationHandler) UserEmailVerificationConfigImpl(org.wso2.carbon.identity.recovery.connector.UserEmailVerificationConfigImpl) UserSelfRegistrationHandler(org.wso2.carbon.identity.recovery.handler.UserSelfRegistrationHandler) ChallengeQuestionManager(org.wso2.carbon.identity.recovery.ChallengeQuestionManager) PasswordRecoveryManager(org.wso2.carbon.identity.recovery.services.password.PasswordRecoveryManager) SecurityQuestionPasswordRecoveryManager(org.wso2.carbon.identity.recovery.password.SecurityQuestionPasswordRecoveryManager) NotificationPasswordRecoveryManager(org.wso2.carbon.identity.recovery.password.NotificationPasswordRecoveryManager) PasswordRecoveryManagerImpl(org.wso2.carbon.identity.recovery.internal.service.impl.password.PasswordRecoveryManagerImpl) IdentityRecoveryException(org.wso2.carbon.identity.recovery.IdentityRecoveryException) UserClaimUpdateConfigImpl(org.wso2.carbon.identity.recovery.connector.UserClaimUpdateConfigImpl) AbstractEventHandler(org.wso2.carbon.identity.event.handler.AbstractEventHandler) AdminForcedPasswordResetConfigImpl(org.wso2.carbon.identity.recovery.connector.AdminForcedPasswordResetConfigImpl) LiteUserRegistrationHandler(org.wso2.carbon.identity.recovery.handler.LiteUserRegistrationHandler) SelfRegistrationConfigImpl(org.wso2.carbon.identity.recovery.connector.SelfRegistrationConfigImpl) IdentityRecoveryException(org.wso2.carbon.identity.recovery.IdentityRecoveryException) BundleContext(org.osgi.framework.BundleContext) PostAuthenticationHandler(org.wso2.carbon.identity.application.authentication.framework.handler.request.PostAuthenticationHandler) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Activate (org.osgi.service.component.annotations.Activate)3 TenantMgtListener (org.wso2.carbon.stratos.common.listeners.TenantMgtListener)3 BundleContext (org.osgi.framework.BundleContext)2 ServiceRegistration (org.osgi.framework.ServiceRegistration)2 UserOperationEventListener (org.wso2.carbon.user.core.listener.UserOperationEventListener)2 Hashtable (java.util.Hashtable)1 AxisObserver (org.apache.axis2.engine.AxisObserver)1 PostAuthenticationHandler (org.wso2.carbon.identity.application.authentication.framework.handler.request.PostAuthenticationHandler)1 ClaimMetadataMgtListener (org.wso2.carbon.identity.claim.metadata.mgt.listener.ClaimMetadataMgtListener)1 AbstractEventHandler (org.wso2.carbon.identity.event.handler.AbstractEventHandler)1 IdentityConnectorConfig (org.wso2.carbon.identity.governance.common.IdentityConnectorConfig)1 IdentityMgtEventListener (org.wso2.carbon.identity.mgt.IdentityMgtEventListener)1 IdentityUserIdResolverListener (org.wso2.carbon.identity.mgt.listener.IdentityUserIdResolverListener)1 IdentityUserNameResolverListener (org.wso2.carbon.identity.mgt.listener.IdentityUserNameResolverListener)1 TenantManagementListener (org.wso2.carbon.identity.mgt.listener.TenantManagementListener)1 UserOperationsNotificationListener (org.wso2.carbon.identity.mgt.listener.UserOperationsNotificationListener)1 UserSessionTerminationListener (org.wso2.carbon.identity.mgt.listener.UserSessionTerminationListener)1 RegistryCleanUpService (org.wso2.carbon.identity.mgt.store.RegistryCleanUpService)1 ChallengeQuestionManager (org.wso2.carbon.identity.recovery.ChallengeQuestionManager)1 IdentityRecoveryException (org.wso2.carbon.identity.recovery.IdentityRecoveryException)1