com.atlassian.crowd.manager.proxy
Class TrustedProxyManagerImpl

java.lang.Object
  extended by com.atlassian.crowd.manager.proxy.TrustedProxyManagerImpl
All Implemented Interfaces:
TrustedProxyManager

public class TrustedProxyManagerImpl
extends Object
implements TrustedProxyManager

Handles the list of proxy servers whose X-Forwarded-For headers we trust. Deals with persisting and querying the list.


Field Summary
protected static String REQUESTED_PROXIES_CACHE
           
 
Constructor Summary
TrustedProxyManagerImpl(PropertyManager propertyManager, CacheManager cacheManager)
           
 
Method Summary
 boolean addAddress(String remoteAddress)
          Adds to the list of servers we trust.
 Set<String> getAddresses()
          Returns the addresses of the trusted proxy servers, or an empty dry if there are none.
 boolean isTrusted(String remoteAddress)
          Returns true if the proxy server is trusted, false otherwise.
 void removeAddress(String remoteAddress)
          Removes from the list of trusted servers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REQUESTED_PROXIES_CACHE

protected static final String REQUESTED_PROXIES_CACHE
Constructor Detail

TrustedProxyManagerImpl

public TrustedProxyManagerImpl(PropertyManager propertyManager,
                               CacheManager cacheManager)
Method Detail

isTrusted

public boolean isTrusted(String remoteAddress)
Returns true if the proxy server is trusted, false otherwise.

Specified by:
isTrusted in interface TrustedProxyManager
Parameters:
remoteAddress - address of the proxy
Returns:
true if the remote address is a trusted proxy

getAddresses

public Set<String> getAddresses()
Returns the addresses of the trusted proxy servers, or an empty dry if there are none. Tries to load the addresses from the cache first. If not in the cache, goes to the PropertyManager and loads from there.

Specified by:
getAddresses in interface TrustedProxyManager
Returns:
addresses of the trusted proxies

addAddress

public boolean addAddress(String remoteAddress)
Adds to the list of servers we trust. Pass an IP address in decimal dot format (eg. 192.168.3.2) Allows IP addresses with subnets as well (eg. 192.168.3.0/24)

Specified by:
addAddress in interface TrustedProxyManager
Parameters:
remoteAddress - host name or IP address
Returns:
true if the addition was successful, false otherwise

removeAddress

public void removeAddress(String remoteAddress)
Removes from the list of trusted servers.

Specified by:
removeAddress in interface TrustedProxyManager
Parameters:
remoteAddress - hostname or IP address


Copyright © 2014 Atlassian. All Rights Reserved.