Search in sources :

Example 1 with UsernameRecoveryReCaptchaConnector

use of org.wso2.carbon.identity.captcha.connector.recaptcha.UsernameRecoveryReCaptchaConnector in project identity-governance by wso2-extensions.

the class CaptchaComponent method activate.

@Activate
protected void activate(ComponentContext context) {
    try {
        // Initialize reCaptcha.
        CaptchaUtil.buildReCaptchaFilterProperties();
        // Initialize and register SSOLoginReCaptchaConfig.
        IdentityConnectorConfig connector = new SSOLoginReCaptchaConfig();
        ((SSOLoginReCaptchaConfig) connector).init(CaptchaDataHolder.getInstance().getIdentityGovernanceService());
        context.getBundleContext().registerService(IdentityConnectorConfig.class, connector, null);
        CaptchaDataHolder.getInstance().addCaptchaConnector((SSOLoginReCaptchaConfig) connector);
        // Initialize and register PathBasedReCaptchaConnector.
        CaptchaConnector captchaConnector = new SelfSignUpReCaptchaConnector();
        captchaConnector.init(CaptchaDataHolder.getInstance().getIdentityGovernanceService());
        CaptchaDataHolder.getInstance().addCaptchaConnector(captchaConnector);
        // Initialize and register UsernameRecoveryReCaptchaConnector.
        captchaConnector = new UsernameRecoveryReCaptchaConnector();
        captchaConnector.init(CaptchaDataHolder.getInstance().getIdentityGovernanceService());
        CaptchaDataHolder.getInstance().addCaptchaConnector(captchaConnector);
        // Initialize and register PasswordRecoveryReCaptchaConnector.
        captchaConnector = new PasswordRecoveryReCaptchaConnector();
        captchaConnector.init(CaptchaDataHolder.getInstance().getIdentityGovernanceService());
        CaptchaDataHolder.getInstance().addCaptchaConnector(captchaConnector);
        // Initialize and register ResendConfirmationReCaptchaConnector.
        captchaConnector = new ResendConfirmationReCaptchaConnector();
        captchaConnector.init(CaptchaDataHolder.getInstance().getIdentityGovernanceService());
        CaptchaDataHolder.getInstance().addCaptchaConnector(captchaConnector);
        AuthenticationDataPublisher failedLoginAttemptValidator = new FailLoginAttemptValidator();
        context.getBundleContext().registerService(AuthenticationDataPublisher.class, failedLoginAttemptValidator, null);
        context.getBundleContext().registerService(AbstractEventHandler.class.getName(), new FailLoginAttemptValidationHandler(), null);
        if (log.isDebugEnabled()) {
            log.debug("Captcha Component is activated");
        }
    } catch (Throwable e) {
        log.error("Failed to start CaptchaComponent", e);
    }
}
Also used : FailLoginAttemptValidationHandler(org.wso2.carbon.identity.captcha.validator.FailLoginAttemptValidationHandler) SelfSignUpReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.SelfSignUpReCaptchaConnector) PasswordRecoveryReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.PasswordRecoveryReCaptchaConnector) CaptchaConnector(org.wso2.carbon.identity.captcha.connector.CaptchaConnector) ResendConfirmationReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.ResendConfirmationReCaptchaConnector) UsernameRecoveryReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.UsernameRecoveryReCaptchaConnector) IdentityConnectorConfig(org.wso2.carbon.identity.governance.common.IdentityConnectorConfig) SelfSignUpReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.SelfSignUpReCaptchaConnector) ResendConfirmationReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.ResendConfirmationReCaptchaConnector) AbstractEventHandler(org.wso2.carbon.identity.event.handler.AbstractEventHandler) PasswordRecoveryReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.PasswordRecoveryReCaptchaConnector) SSOLoginReCaptchaConfig(org.wso2.carbon.identity.captcha.connector.recaptcha.SSOLoginReCaptchaConfig) UsernameRecoveryReCaptchaConnector(org.wso2.carbon.identity.captcha.connector.recaptcha.UsernameRecoveryReCaptchaConnector) AuthenticationDataPublisher(org.wso2.carbon.identity.application.authentication.framework.AuthenticationDataPublisher) FailLoginAttemptValidator(org.wso2.carbon.identity.captcha.validator.FailLoginAttemptValidator) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Activate (org.osgi.service.component.annotations.Activate)1 AuthenticationDataPublisher (org.wso2.carbon.identity.application.authentication.framework.AuthenticationDataPublisher)1 CaptchaConnector (org.wso2.carbon.identity.captcha.connector.CaptchaConnector)1 PasswordRecoveryReCaptchaConnector (org.wso2.carbon.identity.captcha.connector.recaptcha.PasswordRecoveryReCaptchaConnector)1 ResendConfirmationReCaptchaConnector (org.wso2.carbon.identity.captcha.connector.recaptcha.ResendConfirmationReCaptchaConnector)1 SSOLoginReCaptchaConfig (org.wso2.carbon.identity.captcha.connector.recaptcha.SSOLoginReCaptchaConfig)1 SelfSignUpReCaptchaConnector (org.wso2.carbon.identity.captcha.connector.recaptcha.SelfSignUpReCaptchaConnector)1 UsernameRecoveryReCaptchaConnector (org.wso2.carbon.identity.captcha.connector.recaptcha.UsernameRecoveryReCaptchaConnector)1 FailLoginAttemptValidationHandler (org.wso2.carbon.identity.captcha.validator.FailLoginAttemptValidationHandler)1 FailLoginAttemptValidator (org.wso2.carbon.identity.captcha.validator.FailLoginAttemptValidator)1 AbstractEventHandler (org.wso2.carbon.identity.event.handler.AbstractEventHandler)1 IdentityConnectorConfig (org.wso2.carbon.identity.governance.common.IdentityConnectorConfig)1