Class GoogleRecaptchaV2ValidationStrategy
java.lang.Object
de.hybris.platform.commercewebservicescommons.strategies.impl.GoogleRecaptchaV2ValidationStrategy
- All Implemented Interfaces:
CaptchaValidationStrategy
public class GoogleRecaptchaV2ValidationStrategy
extends Object
implements CaptchaValidationStrategy
Strategy to validate the captcha response provided
-
Constructor Summary
ConstructorsConstructorDescriptionGoogleRecaptchaV2ValidationStrategy(org.apache.http.client.HttpClient httpClient, SiteConfigService siteConfigService) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.http.client.HttpClientget the captcha providerprotected SiteConfigServiceget the captcha versionbooleanpreCheckToken(CaptchaValidationContext captchaValidationContext) pre-check the token before really call providervalidate(CaptchaValidationContext context) call the google validation endpoint to validate the captcha token
-
Constructor Details
-
GoogleRecaptchaV2ValidationStrategy
public GoogleRecaptchaV2ValidationStrategy(org.apache.http.client.HttpClient httpClient, SiteConfigService siteConfigService)
-
-
Method Details
-
validate
call the google validation endpoint to validate the captcha token- Specified by:
validatein interfaceCaptchaValidationStrategy- Parameters:
context- : a context contains the token needs to be validated- Returns:
- CaptchaValidationResult : a dto has two fields "success" and "reason", the token is valid when success is true, otherwise , the token is invalid and reason is the error detail.
-
getProviderType
Description copied from interface:CaptchaValidationStrategyget the captcha provider- Specified by:
getProviderTypein interfaceCaptchaValidationStrategy- Returns:
- CaptchaProviderWsDtoType: for now , just GOOGLE
-
getVersion
Description copied from interface:CaptchaValidationStrategyget the captcha version- Specified by:
getVersionin interfaceCaptchaValidationStrategy- Returns:
- CaptchaVersionWsDtoType: for now , just GOOGLE's V2
-
preCheckToken
Description copied from interface:CaptchaValidationStrategypre-check the token before really call provider- Specified by:
preCheckTokenin interfaceCaptchaValidationStrategy- Returns:
-
getHttpClient
protected org.apache.http.client.HttpClient getHttpClient() -
getSiteConfigService
-