Class AccessRule.Builder

  • Enclosing class:
    AccessRule

    public static class AccessRule.Builder
    extends Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • name

        public AccessRule.Builder name​(String name)
        The unique name of the access rule.
        Parameters:
        name - the value to set
        Returns:
        this builder
      • criteria

        public AccessRule.Builder criteria​(List<AccessRuleCriteria> criteria)
        The list of access rule criteria.

        The rule would be applied only for the requests that matched all the listed conditions.

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

        public AccessRule.Builder action​(AccessRule.Action action)
        The action to take when the access criteria are met for a rule.

        If unspecified, defaults to ALLOW.

        - **ALLOW:** Takes no action, just logs the request.

        - **DETECT:** Takes no action, but creates an alert for the request.

        - **BLOCK:** Blocks the request by returning specified response code or showing error page.

        - **BYPASS:** Bypasses some or all challenges.

        - **REDIRECT:** Redirects the request to the specified URL. These fields are required when REDIRECT is selected: redirectUrl, redirectResponseCode.

        - **SHOW_CAPTCHA:** Show a CAPTCHA Challenge page instead of the requested page.

        Regardless of action, no further rules are processed once a rule is matched.

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

        public AccessRule.Builder blockAction​(AccessRule.BlockAction blockAction)
        The method used to block requests if action is set to BLOCK and the access criteria are met.

        If unspecified, defaults to SET_RESPONSE_CODE.

        Parameters:
        blockAction - the value to set
        Returns:
        this builder
      • blockResponseCode

        public AccessRule.Builder blockResponseCode​(Integer blockResponseCode)
        The response status code to return when action is set to BLOCK, blockAction is set to SET_RESPONSE_CODE, and the access criteria are met.

        If unspecified, defaults to 403. The list of available response codes: 200, 201, 202, 204, 206, 300, 301, 302, 303, 304, 307, 400, 401, 403, 404, 405, 408, 409, 411, 412, 413, 414, 415, 416, 422, 444, 494, 495, 496, 497, 499, 500, 501, 502, 503, 504, 507.

        Parameters:
        blockResponseCode - the value to set
        Returns:
        this builder
      • blockErrorPageMessage

        public AccessRule.Builder blockErrorPageMessage​(String blockErrorPageMessage)
        The message to show on the error page when action is set to BLOCK, blockAction is set to SHOW_ERROR_PAGE, and the access criteria are met.

        If unspecified, defaults to ‘Access to the website is blocked.’

        Parameters:
        blockErrorPageMessage - the value to set
        Returns:
        this builder
      • blockErrorPageCode

        public AccessRule.Builder blockErrorPageCode​(String blockErrorPageCode)
        The error code to show on the error page when action is set to BLOCK, blockAction is set to SHOW_ERROR_PAGE, and the access criteria are met.

        If unspecified, defaults to ‘Access rules’.

        Parameters:
        blockErrorPageCode - the value to set
        Returns:
        this builder
      • blockErrorPageDescription

        public AccessRule.Builder blockErrorPageDescription​(String blockErrorPageDescription)
        The description text to show on the error page when action is set to BLOCK, blockAction is set to SHOW_ERROR_PAGE, and the access criteria are met.

        If unspecified, defaults to ‘Access blocked by website owner. Please contact support.’

        Parameters:
        blockErrorPageDescription - the value to set
        Returns:
        this builder
      • bypassChallenges

        public AccessRule.Builder bypassChallenges​(List<AccessRule.BypassChallenges> bypassChallenges)
        The list of challenges to bypass when action is set to BYPASS.

        If unspecified or empty, all challenges are bypassed.

        - **JS_CHALLENGE:** Bypasses JavaScript Challenge.

        - **DEVICE_FINGERPRINT_CHALLENGE:** Bypasses Device Fingerprint Challenge.

        - **HUMAN_INTERACTION_CHALLENGE:** Bypasses Human Interaction Challenge.

        - **CAPTCHA:** Bypasses CAPTCHA Challenge.

        Parameters:
        bypassChallenges - the value to set
        Returns:
        this builder
      • redirectUrl

        public AccessRule.Builder redirectUrl​(String redirectUrl)
        The target to which the request should be redirected, represented as a URI reference.

        Required when action is REDIRECT.

        Parameters:
        redirectUrl - the value to set
        Returns:
        this builder
      • redirectResponseCode

        public AccessRule.Builder redirectResponseCode​(AccessRule.RedirectResponseCode redirectResponseCode)
        The response status code to return when action is set to REDIRECT.

        - **MOVED_PERMANENTLY:** Used for designating the permanent movement of a page (numerical code - 301).

        - **FOUND:** Used for designating the temporary movement of a page (numerical code - 302).

        Parameters:
        redirectResponseCode - the value to set
        Returns:
        this builder
      • captchaTitle

        public AccessRule.Builder captchaTitle​(String captchaTitle)
        The title used when showing a CAPTCHA challenge when action is set to SHOW_CAPTCHA and the request is challenged.
        Parameters:
        captchaTitle - the value to set
        Returns:
        this builder
      • captchaHeader

        public AccessRule.Builder captchaHeader​(String captchaHeader)
        The text to show in the header when showing a CAPTCHA challenge when action is set to SHOW_CAPTCHA and the request is challenged.
        Parameters:
        captchaHeader - the value to set
        Returns:
        this builder
      • captchaFooter

        public AccessRule.Builder captchaFooter​(String captchaFooter)
        The text to show in the footer when showing a CAPTCHA challenge when action is set to SHOW_CAPTCHA and the request is challenged.
        Parameters:
        captchaFooter - the value to set
        Returns:
        this builder
      • captchaSubmitLabel

        public AccessRule.Builder captchaSubmitLabel​(String captchaSubmitLabel)
        The text to show on the label of the CAPTCHA challenge submit button when action is set to SHOW_CAPTCHA and the request is challenged.
        Parameters:
        captchaSubmitLabel - the value to set
        Returns:
        this builder
      • responseHeaderManipulation

        public AccessRule.Builder responseHeaderManipulation​(List<HeaderManipulationAction> responseHeaderManipulation)
        An object that represents an action to apply to an HTTP response headers if all rule criteria will be matched regardless of action value.
        Parameters:
        responseHeaderManipulation - the value to set
        Returns:
        this builder