Search in sources :

Example 1 with TenantRegistrationVerificationHandler

use of org.wso2.carbon.identity.recovery.handler.TenantRegistrationVerificationHandler 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)

Example 2 with TenantRegistrationVerificationHandler

use of org.wso2.carbon.identity.recovery.handler.TenantRegistrationVerificationHandler in project identity-governance by wso2-extensions.

the class TenantRegistrationVerificationHandler method handleClaimUpdate.

protected void handleClaimUpdate(Map<String, Object> eventProperties, UserStoreManager userStoreManager, Map<String, String> claims) throws IdentityEventException {
    User user = getUser(eventProperties, userStoreManager);
    if (log.isDebugEnabled()) {
        log.debug("PreSetUserClaim - TenantRegistrationVerificationHandler for : " + user.toString() + ". This is an update request for the claim:  " + IdentityRecoveryConstants.TENANT_ADMIN_ASK_PASSWORD_CLAIM);
    }
    // Remove claim to prevent persisting this temporary claim.
    claims.remove(IdentityRecoveryConstants.TENANT_ADMIN_ASK_PASSWORD_CLAIM);
    String uuid = UUIDGenerator.generateUUID();
    String notificationType = IdentityRecoveryConstants.NOTIFICATION_TYPE_TENANT_REGISTRATION_CONFIRMATION;
    if (claims.containsKey(IdentityRecoveryConstants.ACCOUNT_LOCKED_CLAIM)) {
        claims.remove(IdentityRecoveryConstants.ACCOUNT_LOCKED_CLAIM);
    }
    setRecoveryData(user, RecoveryScenarios.TENANT_ADMIN_ASK_PASSWORD, RecoverySteps.UPDATE_PASSWORD, uuid);
    lockAccount(user, userStoreManager);
    try {
        triggerNotification(user, notificationType, uuid, Utils.getArbitraryProperties());
    } catch (IdentityRecoveryException e) {
        throw new IdentityEventException("Error while sending  notification.", e);
    }
}
Also used : User(org.wso2.carbon.identity.application.common.model.User) IdentityEventException(org.wso2.carbon.identity.event.IdentityEventException) IdentityRecoveryException(org.wso2.carbon.identity.recovery.IdentityRecoveryException)

Aggregations

IdentityRecoveryException (org.wso2.carbon.identity.recovery.IdentityRecoveryException)2 BundleContext (org.osgi.framework.BundleContext)1 Activate (org.osgi.service.component.annotations.Activate)1 PostAuthenticationHandler (org.wso2.carbon.identity.application.authentication.framework.handler.request.PostAuthenticationHandler)1 User (org.wso2.carbon.identity.application.common.model.User)1 IdentityEventException (org.wso2.carbon.identity.event.IdentityEventException)1 AbstractEventHandler (org.wso2.carbon.identity.event.handler.AbstractEventHandler)1 IdentityConnectorConfig (org.wso2.carbon.identity.governance.common.IdentityConnectorConfig)1 ChallengeQuestionManager (org.wso2.carbon.identity.recovery.ChallengeQuestionManager)1 ResendConfirmationManager (org.wso2.carbon.identity.recovery.confirmation.ResendConfirmationManager)1 AdminForcedPasswordResetConfigImpl (org.wso2.carbon.identity.recovery.connector.AdminForcedPasswordResetConfigImpl)1 LiteRegistrationConfigImpl (org.wso2.carbon.identity.recovery.connector.LiteRegistrationConfigImpl)1 RecoveryConfigImpl (org.wso2.carbon.identity.recovery.connector.RecoveryConfigImpl)1 SelfRegistrationConfigImpl (org.wso2.carbon.identity.recovery.connector.SelfRegistrationConfigImpl)1 UserClaimUpdateConfigImpl (org.wso2.carbon.identity.recovery.connector.UserClaimUpdateConfigImpl)1 UserEmailVerificationConfigImpl (org.wso2.carbon.identity.recovery.connector.UserEmailVerificationConfigImpl)1 AccountConfirmationValidationHandler (org.wso2.carbon.identity.recovery.handler.AccountConfirmationValidationHandler)1 AdminForcedPasswordResetHandler (org.wso2.carbon.identity.recovery.handler.AdminForcedPasswordResetHandler)1 ChallengeAnswerValidationHandler (org.wso2.carbon.identity.recovery.handler.ChallengeAnswerValidationHandler)1 CodeInvalidationHandler (org.wso2.carbon.identity.recovery.handler.CodeInvalidationHandler)1