Class ClientInfoServiceImpl

java.lang.Object
org.dspace.service.impl.ClientInfoServiceImpl
All Implemented Interfaces:
ClientInfoService

public class ClientInfoServiceImpl extends Object implements ClientInfoService
Implementation of ClientInfoService that can provide information on DSpace client requests
Author:
tom dot desair at gmail dot com
  • Constructor Details

  • Method Details

    • getClientIp

      public String getClientIp(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: ClientInfoService
      Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting
      Specified by:
      getClientIp in interface ClientInfoService
      Parameters:
      request - The client HTTP request
      Returns:
      The IP address of the originating client
    • getClientIp

      public String getClientIp(String remoteIp, String xForwardedForHeaderValue)
      Description copied from interface: ClientInfoService
      Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting
      Specified by:
      getClientIp in interface ClientInfoService
      Parameters:
      remoteIp - the remote address of the current request
      xForwardedForHeaderValue - The value of the X-Forwarded-For header
      Returns:
      The IP address of the originating client
    • isUseProxiesEnabled

      public boolean isUseProxiesEnabled()
      Description copied from interface: ClientInfoService
      Does DSpace take into account HTTP proxy headers or not
      Specified by:
      isUseProxiesEnabled in interface ClientInfoService
      Returns:
      true if this is the case, false otherwise
    • isRequestFromTrustedProxy

      public boolean isRequestFromTrustedProxy(String ipAddress)
      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:
      isRequestFromTrustedProxy in interface ClientInfoService
      Parameters:
      ipAddress - IP address to check for
      Returns:
      true if trusted, false otherwise