use of org.wso2.carbon.identity.captcha.connector.CaptchaPreValidationResponse in project identity-governance by wso2-extensions.
the class UsernameRecoveryReCaptchaConnector method preValidate.
@Override
public CaptchaPreValidationResponse preValidate(ServletRequest servletRequest, ServletResponse servletResponse) throws CaptchaException {
CaptchaPreValidationResponse preValidationResponse = new CaptchaPreValidationResponse();
String path = ((HttpServletRequest) servletRequest).getRequestURI();
HttpServletResponse httpServletResponse = ((HttpServletResponse) servletResponse);
if (CaptchaUtil.isPathAvailable(path, RECOVER_USERNAME_URL)) {
httpServletResponse.setHeader("reCaptcha", "conditional");
preValidationResponse.setCaptchaValidationRequired(true);
}
return preValidationResponse;
}
Aggregations