use of org.wso2.carbon.identity.captcha.connector.recaptcha.SelfSignUpReCaptchaConnector 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);
}
}
Aggregations