Package org.dspace.service.impl
Class ClientInfoServiceImpl
java.lang.Object
org.dspace.service.impl.ClientInfoServiceImpl
- All Implemented Interfaces:
ClientInfoService
Implementation of
ClientInfoService that can provide information on DSpace client requests- Author:
- tom dot desair at gmail dot com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClientIp(jakarta.servlet.http.HttpServletRequest request) Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" settinggetClientIp(String remoteIp, String xForwardedForHeaderValue) Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" settingbooleanisRequestFromTrustedProxy(String ipAddress) Whether a request is from a trusted proxy or not.booleanDoes DSpace take into account HTTP proxy headers or not
-
Constructor Details
-
ClientInfoServiceImpl
-
-
Method Details
-
getClientIp
Description copied from interface:ClientInfoServiceGet the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting- Specified by:
getClientIpin interfaceClientInfoService- Parameters:
request- The client HTTP request- Returns:
- The IP address of the originating client
-
getClientIp
Description copied from interface:ClientInfoServiceGet the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting- Specified by:
getClientIpin interfaceClientInfoService- Parameters:
remoteIp- the remote address of the current requestxForwardedForHeaderValue- The value of the X-Forwarded-For header- Returns:
- The IP address of the originating client
-
isUseProxiesEnabled
public boolean isUseProxiesEnabled()Description copied from interface:ClientInfoServiceDoes DSpace take into account HTTP proxy headers or not- Specified by:
isUseProxiesEnabledin interfaceClientInfoService- Returns:
- true if this is the case, false otherwise
-
isRequestFromTrustedProxy
Whether a request is from a trusted proxy or not. Only returns true if trusted proxies are specified and the ipAddress is contained in those proxies. False in all other cases- Specified by:
isRequestFromTrustedProxyin interfaceClientInfoService- Parameters:
ipAddress- IP address to check for- Returns:
- true if trusted, false otherwise
-