Class AbstractMockUrlValidator
java.lang.Object
de.hybris.platform.acceleratorservices.web.payment.validation.AbstractMockUrlValidator
- Direct Known Subclasses:
HopMockUrlValidator,SopMockUrlValidator
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringextractPathFromUrl(String url) Extracts the path from the passed url.protected StringExtracts the protocol, host and port from passed url.getAllowedHosts(String key) Returns a list of allowed hosts from configuration based on the key.Return a list of strings containing allowed protocol, host and port for all base sites.protected abstract Stringprotected booleanChecks if strict check is enabled or not.protected booleanisValidUrlSyntax(String url) Perform null checks and scheme checks as defined inUrlSchemeValidator.voidsetBaseSiteService(BaseSiteService baseSiteService) voidsetConfigurationService(ConfigurationService configurationService) voidsetSiteBaseUrlResolutionService(SiteBaseUrlResolutionService siteBaseUrlResolutionService) booleanValidate the passed payment response url, if it is allowed or not.
-
Field Details
-
ALLOWED_PAYMENT_HOSTS
- See Also:
-
URL_STRICT_CHECK_ENABLED
- See Also:
-
SEPARATOR
- See Also:
-
-
Constructor Details
-
AbstractMockUrlValidator
public AbstractMockUrlValidator()
-
-
Method Details
-
getAllowedHosts
Returns a list of allowed hosts from configuration based on the key. Falls back to a list of default allowed hosts in case configuration is empty.- Parameters:
key- config key to look for.- Returns:
- list of allowed hosts
-
getDefaultAllowedSchemeHostAndPortUrls
Return a list of strings containing allowed protocol, host and port for all base sites. example: "http://electronics.local:9001", "https://electronics.local:9002"- Returns:
- list of default allowed urls, containing scheme, host and protocols
-
isStrictCheckEnabled
protected boolean isStrictCheckEnabled()Checks if strict check is enabled or not. based on acceleratorservices.payment.url.strict.enabled property in configuration.- Returns:
- true if enabled, otherwise false, also true if property not defined.
-
isValidUrlSyntax
Perform null checks and scheme checks as defined inUrlSchemeValidator.- Parameters:
url- url to check- Returns:
- true if url is valid, false otherwise.
-
extractSchemeHostAndPortFromUrl
Extracts the protocol, host and port from passed url.- Parameters:
url- url to be parsed.- Returns:
- url containing only scheme, host and port.
-
extractPathFromUrl
Extracts the path from the passed url.- Parameters:
url- url to be parsed.- Returns:
- path component of the url.
-
getConfigurationService
-
setConfigurationService
-
getBaseSiteService
-
setBaseSiteService
-
getSiteBaseUrlResolutionService
-
setSiteBaseUrlResolutionService
public void setSiteBaseUrlResolutionService(SiteBaseUrlResolutionService siteBaseUrlResolutionService) -
validatePaymentResponseUrl
Validate the passed payment response url, if it is allowed or not. For a Url to be allowed it must be only containing allowed scheme, host and port. Allowed hosts are picked up from config property acceleratorservices.payment.response.url.allowlist Also the url must contain the relative path (e.g. /sop/response).If the property acceleratorservices.payment.url.strict.enabled is set to false this method only does scheme validation
UrlSchemeValidator, and skips other validations.- Parameters:
url- url to be validated.- Returns:
- true if url is allowed, otherwise false.
-
getPaymentResponseEndRelativeUrl
-