Class TrustedProxyManagerImpl

java.lang.Object
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 Details

    • REQUESTED_PROXIES_CACHE

      protected static final String REQUESTED_PROXIES_CACHE
  • Constructor Details

  • Method Details

    • registerListeners

      @PostConstruct public void registerListeners()
    • unregisterListeners

      @PreDestroy public void unregisterListeners()
    • isTrusted

      public boolean isTrusted(String remoteAddress)
      Returns true</tt> if the proxy server is trusted, <tt>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 set if there are none. Loads the addresses using the PropertyManager.
      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