Class JsChallenge.Builder

  • Enclosing class:
    JsChallenge

    public static class JsChallenge.Builder
    extends Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • isEnabled

        public JsChallenge.Builder isEnabled​(Boolean isEnabled)
        Enables or disables the JavaScript challenge Web Application Firewall feature.
        Parameters:
        isEnabled - the value to set
        Returns:
        this builder
      • action

        public JsChallenge.Builder action​(JsChallenge.Action action)
        The action to take against requests from detected bots.

        If unspecified, defaults to DETECT.

        Parameters:
        action - the value to set
        Returns:
        this builder
      • failureThreshold

        public JsChallenge.Builder failureThreshold​(Integer failureThreshold)
        The number of failed requests before taking action.

        If unspecified, defaults to 10.

        Parameters:
        failureThreshold - the value to set
        Returns:
        this builder
      • actionExpirationInSeconds

        public JsChallenge.Builder actionExpirationInSeconds​(Integer actionExpirationInSeconds)
        The number of seconds between challenges from the same IP address.

        If unspecified, defaults to 60.

        Parameters:
        actionExpirationInSeconds - the value to set
        Returns:
        this builder
      • setHttpHeader

        public JsChallenge.Builder setHttpHeader​(Header setHttpHeader)
        Adds an additional HTTP header to requests that fail the challenge before being passed to the origin.

        Only applicable when the action is set to DETECT.

        Parameters:
        setHttpHeader - the value to set
        Returns:
        this builder
      • areRedirectsChallenged

        public JsChallenge.Builder areRedirectsChallenged​(Boolean areRedirectsChallenged)
        When enabled, redirect responses from the origin will also be challenged.

        This will change HTTP 301/302 responses from origin to HTTP 200 with an HTML body containing JavaScript page redirection.

        Parameters:
        areRedirectsChallenged - the value to set
        Returns:
        this builder
      • criteria

        public JsChallenge.Builder criteria​(List<AccessRuleCriteria> criteria)
        When defined, the JavaScript Challenge would be applied only for the requests that matched all the listed conditions.
        Parameters:
        criteria - the value to set
        Returns:
        this builder
      • isNatEnabled

        public JsChallenge.Builder isNatEnabled​(Boolean isNatEnabled)
        When enabled, the user is identified not only by the IP address but also by an unique additional hash, which prevents blocking visitors with shared IP addresses.
        Parameters:
        isNatEnabled - the value to set
        Returns:
        this builder