Class TrustedProxyManagerImpl
java.lang.Object
com.atlassian.crowd.manager.proxy.TrustedProxyManagerImpl
- All Implemented Interfaces:
TrustedProxyManager
Handles the list of proxy servers whose X-Forwarded-For headers we trust. Deals with persisting and querying the list.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTrustedProxyManagerImpl
(PropertyManager propertyManager, com.atlassian.cache.Cache<String, Boolean> cache, ClusterMessageService clusterMessageService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
addAddress
(String remoteAddress) Adds to the list of servers we trust.Returns the addresses of the trusted proxy servers, or an empty set if there are none.boolean
Returnstrue</tt> if the proxy server is trusted, <tt>false
otherwise.void
void
removeAddress
(String remoteAddress) Removes from the list of trusted servers.void
-
Field Details
-
REQUESTED_PROXIES_CACHE
-
-
Constructor Details
-
TrustedProxyManagerImpl
public TrustedProxyManagerImpl(PropertyManager propertyManager, com.atlassian.cache.Cache<String, Boolean> cache, ClusterMessageService clusterMessageService)
-
-
Method Details
-
registerListeners
@PostConstruct public void registerListeners() -
unregisterListeners
@PreDestroy public void unregisterListeners() -
isTrusted
Returnstrue</tt> if the proxy server is trusted, <tt>false
otherwise.- Specified by:
isTrusted
in interfaceTrustedProxyManager
- Parameters:
remoteAddress
- address of the proxy- Returns:
true
if the remote address is a trusted proxy
-
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 interfaceTrustedProxyManager
- Returns:
- addresses of the trusted proxies
-
addAddress
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 interfaceTrustedProxyManager
- Parameters:
remoteAddress
- host name or IP address- Returns:
- true if the addition was successful, false otherwise
-
removeAddress
Removes from the list of trusted servers.- Specified by:
removeAddress
in interfaceTrustedProxyManager
- Parameters:
remoteAddress
- hostname or IP address
-