Class GeoserverAuthHeaderRequest

  • All Implemented Interfaces:
    javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

    public class GeoserverAuthHeaderRequest
    extends MutableHttpServletRequest
    Utility class for basic auth based requests in the geoserver interceptor context. Accepts a user and password via the constructor, which will be used to add an appropriate basic auth header to the requests.

    Credits go to https://stackoverflow.com/a/2811841 and https://stackoverflow.com/a/44200124

    Author:
    Nils Bühner
    • Field Summary

      • Fields inherited from interface javax.servlet.http.HttpServletRequest

        BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
    • Constructor Summary

      Constructors 
      Constructor Description
      GeoserverAuthHeaderRequest​(javax.servlet.http.HttpServletRequest request, String user, String password)
      Constructs a new servlet request with an additional x-geoserver-credentials header containing the given username/password as HTTP basic auth encoded value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getHeader​(String name)  
      Enumeration<String> getHeaderNames()  
      Enumeration<String> getHeaders​(String name)  
      • Methods inherited from class javax.servlet.http.HttpServletRequestWrapper

        authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgrade
      • Methods inherited from class javax.servlet.ServletRequestWrapper

        getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterNames, getParameterValues, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
      • Methods inherited from interface javax.servlet.ServletRequest

        getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterNames, getParameterValues, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
    • Constructor Detail

      • GeoserverAuthHeaderRequest

        public GeoserverAuthHeaderRequest​(javax.servlet.http.HttpServletRequest request,
                                          String user,
                                          String password)
        Constructs a new servlet request with an additional x-geoserver-credentials header containing the given username/password as HTTP basic auth encoded value.
        Parameters:
        request - the original request
        user - the geoserver user name
        password - the password
    • Method Detail

      • getHeaders

        public Enumeration<String> getHeaders​(String name)
        Specified by:
        getHeaders in interface javax.servlet.http.HttpServletRequest
        Overrides:
        getHeaders in class javax.servlet.http.HttpServletRequestWrapper
      • getHeaderNames

        public Enumeration<String> getHeaderNames()
        Specified by:
        getHeaderNames in interface javax.servlet.http.HttpServletRequest
        Overrides:
        getHeaderNames in class javax.servlet.http.HttpServletRequestWrapper