Class AbstractMockUrlValidator

java.lang.Object
de.hybris.platform.acceleratorservices.web.payment.validation.AbstractMockUrlValidator
Direct Known Subclasses:
HopMockUrlValidator, SopMockUrlValidator

public abstract class AbstractMockUrlValidator extends Object
  • Field Details

  • Constructor Details

    • AbstractMockUrlValidator

      public AbstractMockUrlValidator()
  • Method Details

    • getAllowedHosts

      protected List<String> getAllowedHosts(String key)
      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

      protected List<String> 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

      protected boolean isValidUrlSyntax(String url)
      Perform null checks and scheme checks as defined in UrlSchemeValidator.
      Parameters:
      url - url to check
      Returns:
      true if url is valid, false otherwise.
    • extractSchemeHostAndPortFromUrl

      protected String extractSchemeHostAndPortFromUrl(String url)
      Extracts the protocol, host and port from passed url.
      Parameters:
      url - url to be parsed.
      Returns:
      url containing only scheme, host and port.
    • extractPathFromUrl

      protected String extractPathFromUrl(String url)
      Extracts the path from the passed url.
      Parameters:
      url - url to be parsed.
      Returns:
      path component of the url.
    • getConfigurationService

      public ConfigurationService getConfigurationService()
    • setConfigurationService

      public void setConfigurationService(ConfigurationService configurationService)
    • getBaseSiteService

      public BaseSiteService getBaseSiteService()
    • setBaseSiteService

      public void setBaseSiteService(BaseSiteService baseSiteService)
    • getSiteBaseUrlResolutionService

      public SiteBaseUrlResolutionService getSiteBaseUrlResolutionService()
    • setSiteBaseUrlResolutionService

      public void setSiteBaseUrlResolutionService(SiteBaseUrlResolutionService siteBaseUrlResolutionService)
    • validatePaymentResponseUrl

      public boolean validatePaymentResponseUrl(String url)
      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

      protected abstract String getPaymentResponseEndRelativeUrl()