Interface ClientInfoService

  • All Known Implementing Classes:
    ClientInfoServiceImpl

    public interface ClientInfoService
    Service that can be used to retrieve information about DSpace clients
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String getClientIp​(String remoteIp, String xForwardedForHeaderValue)
      Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting
      String getClientIp​(javax.servlet.http.HttpServletRequest request)
      Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting
      boolean isRequestFromTrustedProxy​(String ipAddress)
      Whether a request is from a trusted proxy or not.
      boolean isUseProxiesEnabled()
      Does DSpace take into account HTTP proxy headers or not
    • Method Detail

      • getClientIp

        String getClientIp​(javax.servlet.http.HttpServletRequest request)
        Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting
        Parameters:
        request - The client HTTP request
        Returns:
        The IP address of the originating client
      • getClientIp

        String getClientIp​(String remoteIp,
                           String xForwardedForHeaderValue)
        Get the client IP of this request taking into account the X-Forwarded-For header and the "useProxies" setting
        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

        boolean isUseProxiesEnabled()
        Does DSpace take into account HTTP proxy headers or not
        Returns:
        true if this is the case, false otherwise
      • isRequestFromTrustedProxy

        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
        Parameters:
        ipAddress - IP address to check for
        Returns:
        true if trusted, false otherwise