com.atlassian.crowd.manager.validation
Class XForwardedForUtil

java.lang.Object
  extended by 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 Summary
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.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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


Copyright © 2013 Atlassian. All Rights Reserved.