Class XForwardedForUtil

java.lang.Object
com.atlassian.crowd.manager.validation.XForwardedForUtil

public class XForwardedForUtil extends Object
Utility class for handling the X-Forwarded-For (XFF) HTTP request header.
Since:
2.2
  • Method Details

    • getTrustedAddress

      public static InetAddress getTrustedAddress(TrustedProxyManager trustedProxyManager, javax.servlet.http.HttpServletRequest request)
      Returns the originating client address the proxies are forwarding for if the proxies are trusted, otherwise, return the request address.
      Parameters:
      trustedProxyManager - used to determine if the proxy address is trusted
      request - HTTP request
      Returns:
      originating client address if the proxies are trusted, otherwise, the request address is returned
    • getTrustedAddress

      public static String getTrustedAddress(TrustedProxyManager trustedProxyManager, String requestAddress, String xForwardedFor)
      Returns the originating client address the proxies are forwarding for if all the proxies are trusted, otherwise, return the request address.
      Parameters:
      trustedProxyManager - used to determine if the proxy address is trusted
      requestAddress - HTTP request address
      xForwardedFor - X-Forwarded-For header
      Returns:
      originating client address if the proxies are trusted, otherwise, the request address is returned