Package org.owasp.esapi.filters
Class SecurityWrapperRequest
- java.lang.Object
-
- javax.servlet.ServletRequestWrapper
-
- javax.servlet.http.HttpServletRequestWrapper
-
- org.owasp.esapi.filters.SecurityWrapperRequest
-
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest
public class SecurityWrapperRequest extends javax.servlet.http.HttpServletRequestWrapper implements javax.servlet.http.HttpServletRequestThis request wrapper simply overrides unsafe methods in the HttpServletRequest API with safe versions that return canonicalized data where possible. The wrapper returns a safe value when a validation error is detected, including stripped or empty strings.
-
-
Constructor Summary
Constructors Constructor Description SecurityWrapperRequest(javax.servlet.http.HttpServletRequest request)Construct a safe request that overrides the default request methods with safer versions.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetAllowableContentRoot()java.lang.ObjectgetAttribute(java.lang.String name)Same as HttpServletRequest, no security changes required.java.util.EnumerationgetAttributeNames()Same as HttpServletRequest, no security changes required.java.lang.StringgetAuthType()Same as HttpServletRequest, no security changes required.java.lang.StringgetCharacterEncoding()Same as HttpServletRequest, no security changes required.intgetContentLength()Same as HttpServletRequest, no security changes required.java.lang.StringgetContentType()Same as HttpServletRequest, no security changes required.java.lang.StringgetContextPath()Returns the context path from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.javax.servlet.http.Cookie[]getCookies()Returns the array of Cookies from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.longgetDateHeader(java.lang.String name)Same as HttpServletRequest, no security changes required.java.lang.StringgetHeader(java.lang.String name)Returns the named header from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.util.EnumerationgetHeaderNames()Returns the enumeration of header names from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.util.EnumerationgetHeaders(java.lang.String name)Returns the enumeration of headers from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.javax.servlet.ServletInputStreamgetInputStream()Same as HttpServletRequest, no security changes required.intgetIntHeader(java.lang.String name)Same as HttpServletRequest, no security changes required.java.lang.StringgetLocalAddr()Same as HttpServletRequest, no security changes required.java.util.LocalegetLocale()Same as HttpServletRequest, no security changes required.java.util.EnumerationgetLocales()Same as HttpServletRequest, no security changes required.java.lang.StringgetLocalName()Same as HttpServletRequest, no security changes required.intgetLocalPort()Same as HttpServletRequest, no security changes required.java.lang.StringgetMethod()Same as HttpServletRequest, no security changes required.java.lang.StringgetParameter(java.lang.String name)Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetParameter(java.lang.String name, boolean allowNull)Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetParameter(java.lang.String name, boolean allowNull, int maxLength)Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetParameter(java.lang.String name, boolean allowNull, int maxLength, java.lang.String regexName)Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.util.MapgetParameterMap()Returns the parameter map from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.util.EnumerationgetParameterNames()Returns the enumeration of parameter names from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.String[]getParameterValues(java.lang.String name)Returns the array of matching parameter values from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetPathInfo()Returns the path info from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetPathTranslated()Same as HttpServletRequest, no security changes required.java.lang.StringgetProtocol()Same as HttpServletRequest, no security changes required.java.lang.StringgetQueryString()Returns the query string from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.io.BufferedReadergetReader()Same as HttpServletRequest, no security changes required.java.lang.StringgetRealPath(java.lang.String path)Deprecated.in servlet spec 2.1.java.lang.StringgetRemoteAddr()Same as HttpServletRequest, no security changes required.java.lang.StringgetRemoteHost()Same as HttpServletRequest, no security changes required.intgetRemotePort()Same as HttpServletRequest, no security changes required.java.lang.StringgetRemoteUser()Returns the name of the ESAPI user associated with this getHttpServletRequest().javax.servlet.RequestDispatchergetRequestDispatcher(java.lang.String path)Checks to make sure the path to forward to is within the WEB-INF directory and then returns the dispatcher.java.lang.StringgetRequestedSessionId()Returns the URI from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetRequestURI()Returns the URI from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringBuffergetRequestURL()Returns the URL from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetScheme()Returns the scheme from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.java.lang.StringgetServerName()Returns the server name (host header) from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.intgetServerPort()Returns the server port (after the : in the host header) from the HttpServletRequest after parsing and checking the range 0-65536.java.lang.StringgetServletPath()Returns the server path from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.javax.servlet.http.HttpSessiongetSession()Returns a session, creating it if necessary, and sets the HttpOnly flag on the Session ID cookie.javax.servlet.http.HttpSessiongetSession(boolean create)Returns the current session associated with this request or, if there is no current session andcreateistrue, returns a new session and sets the HttpOnly flag on the session ID cookie.java.security.PrincipalgetUserPrincipal()Returns the ESAPI User associated with this getHttpServletRequest().booleanisRequestedSessionIdFromCookie()Same as HttpServletRequest, no security changes required.booleanisRequestedSessionIdFromUrl()Deprecated.in servlet spec 2.1.booleanisRequestedSessionIdFromURL()Same as HttpServletRequest, no security changes required.booleanisRequestedSessionIdValid()Same as HttpServletRequest, no security changes required.booleanisSecure()Same as HttpServletRequest, no security changes required.booleanisUserInRole(java.lang.String role)Returns true if the ESAPI User associated with this request has the specified role.voidremoveAttribute(java.lang.String name)Same as HttpServletRequest, no security changes required.voidsetAllowableContentRoot(java.lang.String allowableContentRoot)voidsetAttribute(java.lang.String name, java.lang.Object o)Same as HttpServletRequest, no security changes required.voidsetCharacterEncoding(java.lang.String enc)Sets the character encoding scheme to the ESAPI configured encoding scheme.-
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getHttpServletMapping, getPart, getParts, getTrailerFields, isTrailerFieldsReady, login, logout, newPushBuilder, upgrade
-
Methods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getContentLengthLong, getDispatcherType, getRequest, getServletContext, isAsyncStarted, isAsyncSupported, isWrapperFor, isWrapperFor, setRequest, startAsync, startAsync
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
Same as HttpServletRequest, no security changes required.- Specified by:
getAttributein interfacejavax.servlet.ServletRequest- Overrides:
getAttributein classjavax.servlet.ServletRequestWrapper- Parameters:
name- The attribute name- Returns:
- The attribute value
-
getAttributeNames
public java.util.Enumeration getAttributeNames()
Same as HttpServletRequest, no security changes required.- Specified by:
getAttributeNamesin interfacejavax.servlet.ServletRequest- Overrides:
getAttributeNamesin classjavax.servlet.ServletRequestWrapper- Returns:
- An
Enumerationof attribute names.
-
getAuthType
public java.lang.String getAuthType()
Same as HttpServletRequest, no security changes required.- Specified by:
getAuthTypein interfacejavax.servlet.http.HttpServletRequest- Overrides:
getAuthTypein classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The authentication type
-
getCharacterEncoding
public java.lang.String getCharacterEncoding()
Same as HttpServletRequest, no security changes required.- Specified by:
getCharacterEncodingin interfacejavax.servlet.ServletRequest- Overrides:
getCharacterEncodingin classjavax.servlet.ServletRequestWrapper- Returns:
- The character-encoding for this
HttpServletRequest
-
getContentLength
public int getContentLength()
Same as HttpServletRequest, no security changes required.- Specified by:
getContentLengthin interfacejavax.servlet.ServletRequest- Overrides:
getContentLengthin classjavax.servlet.ServletRequestWrapper- Returns:
- The content-length for this
HttpServletRequest
-
getContentType
public java.lang.String getContentType()
Same as HttpServletRequest, no security changes required.- Specified by:
getContentTypein interfacejavax.servlet.ServletRequest- Overrides:
getContentTypein classjavax.servlet.ServletRequestWrapper- Returns:
- The content-type for this
HttpServletRequest
-
getContextPath
public java.lang.String getContextPath()
Returns the context path from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getContextPathin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getContextPathin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The context path for this
HttpServletRequest
-
getCookies
public javax.servlet.http.Cookie[] getCookies()
Returns the array of Cookies from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getCookiesin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getCookiesin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- An array of
Cookies for thisHttpServletRequest
-
getDateHeader
public long getDateHeader(java.lang.String name)
Same as HttpServletRequest, no security changes required.- Specified by:
getDateHeaderin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getDateHeaderin classjavax.servlet.http.HttpServletRequestWrapper- Parameters:
name- Specifies the name of the HTTP request header; e.g.,If-Modified-Since.- Returns:
- a long value representing the date specified in the header
expressed as the number of milliseconds since
January 1, 1970 GMT, or-1if the named header was not included with the request.
-
getHeader
public java.lang.String getHeader(java.lang.String name)
Returns the named header from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getHeaderin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getHeaderin classjavax.servlet.http.HttpServletRequestWrapper- Parameters:
name- The name of an HTTP request header- Returns:
- The specified header value is returned.
-
getHeaderNames
public java.util.Enumeration getHeaderNames()
Returns the enumeration of header names from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getHeaderNamesin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getHeaderNamesin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- An
Enumerationof header names associated with this request.
-
getHeaders
public java.util.Enumeration getHeaders(java.lang.String name)
Returns the enumeration of headers from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getHeadersin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getHeadersin classjavax.servlet.http.HttpServletRequestWrapper- Parameters:
name- The name of an HTTP request header.- Returns:
- An
Enumerationof headers from the request after canonicalizing and filtering has been performed.
-
getInputStream
public javax.servlet.ServletInputStream getInputStream() throws java.io.IOExceptionSame as HttpServletRequest, no security changes required. Note that this input stream may contain attacks and the developer is responsible for canonicalizing, validating, and encoding any data from this stream.- Specified by:
getInputStreamin interfacejavax.servlet.ServletRequest- Overrides:
getInputStreamin classjavax.servlet.ServletRequestWrapper- Returns:
- The
ServletInputStreamassociated with thisHttpServletRequest. - Throws:
java.io.IOException- Thrown if an input exception is thrown, such as the remote peer closing the connection.
-
getIntHeader
public int getIntHeader(java.lang.String name)
Same as HttpServletRequest, no security changes required.- Specified by:
getIntHeaderin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getIntHeaderin classjavax.servlet.http.HttpServletRequestWrapper- Parameters:
name- The name of an HTTP request header.- Returns:
- Returns the value of the specified request header as an
int.
-
getLocalAddr
public java.lang.String getLocalAddr()
Same as HttpServletRequest, no security changes required.- Specified by:
getLocalAddrin interfacejavax.servlet.ServletRequest- Overrides:
getLocalAddrin classjavax.servlet.ServletRequestWrapper- Returns:
- A
Stringcontaining the IP address on which the request was received.
-
getLocale
public java.util.Locale getLocale()
Same as HttpServletRequest, no security changes required.- Specified by:
getLocalein interfacejavax.servlet.ServletRequest- Overrides:
getLocalein classjavax.servlet.ServletRequestWrapper- Returns:
- The preferred
Localefor the client.
-
getLocales
public java.util.Enumeration getLocales()
Same as HttpServletRequest, no security changes required.- Specified by:
getLocalesin interfacejavax.servlet.ServletRequest- Overrides:
getLocalesin classjavax.servlet.ServletRequestWrapper- Returns:
- An
Enumerationof preferredLocaleobjects for the client.
-
getLocalName
public java.lang.String getLocalName()
Same as HttpServletRequest, no security changes required.- Specified by:
getLocalNamein interfacejavax.servlet.ServletRequest- Overrides:
getLocalNamein classjavax.servlet.ServletRequestWrapper- Returns:
- A
Stringcontaining the host name of the IP on which the request was received.
-
getLocalPort
public int getLocalPort()
Same as HttpServletRequest, no security changes required.- Specified by:
getLocalPortin interfacejavax.servlet.ServletRequest- Overrides:
getLocalPortin classjavax.servlet.ServletRequestWrapper- Returns:
- Returns the Internet Protocol (IP) port number of the interface on which the request was received.
-
getMethod
public java.lang.String getMethod()
Same as HttpServletRequest, no security changes required.- Specified by:
getMethodin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getMethodin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- Returns the name of the HTTP method with which this request was made.
-
getParameter
public java.lang.String getParameter(java.lang.String name)
Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getParameterin interfacejavax.servlet.ServletRequest- Overrides:
getParameterin classjavax.servlet.ServletRequestWrapper- Parameters:
name- The parameter name for the request- Returns:
- The "scrubbed" parameter value.
-
getParameter
public java.lang.String getParameter(java.lang.String name, boolean allowNull)Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Parameters:
name- The parameter name for the requestallowNull- Whether null values are allowed- Returns:
- The "scrubbed" parameter value.
-
getParameter
public java.lang.String getParameter(java.lang.String name, boolean allowNull, int maxLength)Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Parameters:
name- The parameter name for the requestallowNull- Whether null values are allowedmaxLength- The maximum length allowed- Returns:
- The "scrubbed" parameter value.
-
getParameter
public java.lang.String getParameter(java.lang.String name, boolean allowNull, int maxLength, java.lang.String regexName)Returns the named parameter from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Parameters:
name- The parameter name for the requestallowNull- Whether null values are allowedmaxLength- The maximum length allowedregexName- The name of the regex mapped from ESAPI.properties- Returns:
- The "scrubbed" parameter value.
-
getParameterMap
public java.util.Map getParameterMap()
Returns the parameter map from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getParameterMapin interfacejavax.servlet.ServletRequest- Overrides:
getParameterMapin classjavax.servlet.ServletRequestWrapper- Returns:
- A
Mapcontaining scrubbed parameter names / value pairs.
-
getParameterNames
public java.util.Enumeration getParameterNames()
Returns the enumeration of parameter names from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getParameterNamesin interfacejavax.servlet.ServletRequest- Overrides:
getParameterNamesin classjavax.servlet.ServletRequestWrapper- Returns:
- An
Enumerationof properly "scrubbed" parameter names.
-
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
Returns the array of matching parameter values from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getParameterValuesin interfacejavax.servlet.ServletRequest- Overrides:
getParameterValuesin classjavax.servlet.ServletRequestWrapper- Parameters:
name- The parameter name- Returns:
- An array of matching "scrubbed" parameter values or
nullif the parameter does not exist.
-
getPathInfo
public java.lang.String getPathInfo()
Returns the path info from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getPathInfoin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getPathInfoin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- Returns any extra path information, appropriately scrubbed, associated with the URL the client sent when it made this request.
-
getPathTranslated
public java.lang.String getPathTranslated()
Same as HttpServletRequest, no security changes required.- Specified by:
getPathTranslatedin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getPathTranslatedin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- Returns any extra path information, appropriate scrubbed, after the servlet name but before the query string, and translates it to a real path.
-
getProtocol
public java.lang.String getProtocol()
Same as HttpServletRequest, no security changes required.- Specified by:
getProtocolin interfacejavax.servlet.ServletRequest- Overrides:
getProtocolin classjavax.servlet.ServletRequestWrapper- Returns:
- Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
-
getQueryString
public java.lang.String getQueryString()
Returns the query string from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getQueryStringin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getQueryStringin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The scrubbed query string is returned.
-
getReader
public java.io.BufferedReader getReader() throws java.io.IOExceptionSame as HttpServletRequest, no security changes required. Note that this reader may contain attacks and the developer is responsible for canonicalizing, validating, and encoding any data from this stream.- Specified by:
getReaderin interfacejavax.servlet.ServletRequest- Overrides:
getReaderin classjavax.servlet.ServletRequestWrapper- Returns:
- aA
BufferedReadercontaining the body of the request. - Throws:
java.io.IOException- If an input error occurred while reading the request body (e.g., premature EOF).
-
getRealPath
@Deprecated public java.lang.String getRealPath(java.lang.String path)
Deprecated.in servlet spec 2.1. UseServletContext.getRealPath(String)instead.Same as HttpServletRequest, no security changes required.- Specified by:
getRealPathin interfacejavax.servlet.ServletRequest- Overrides:
getRealPathin classjavax.servlet.ServletRequestWrapper- Parameters:
path- A virtual path on a web or application server; e.g., "/index.htm".- Returns:
- Returns a String containing the real path for a given virtual path.
-
getRemoteAddr
public java.lang.String getRemoteAddr()
Same as HttpServletRequest, no security changes required.- Specified by:
getRemoteAddrin interfacejavax.servlet.ServletRequest- Overrides:
getRemoteAddrin classjavax.servlet.ServletRequestWrapper- Returns:
- Returns the IP address of the client or last proxy that sent the request.
-
getRemoteHost
public java.lang.String getRemoteHost()
Same as HttpServletRequest, no security changes required.- Specified by:
getRemoteHostin interfacejavax.servlet.ServletRequest- Overrides:
getRemoteHostin classjavax.servlet.ServletRequestWrapper- Returns:
- The remote host
-
getRemotePort
public int getRemotePort()
Same as HttpServletRequest, no security changes required.- Specified by:
getRemotePortin interfacejavax.servlet.ServletRequest- Overrides:
getRemotePortin classjavax.servlet.ServletRequestWrapper- Returns:
- The remote port
-
getRemoteUser
public java.lang.String getRemoteUser()
Returns the name of the ESAPI user associated with this getHttpServletRequest().- Specified by:
getRemoteUserin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getRemoteUserin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- Returns the fully qualified name of the client or the last proxy that sent the request
-
getRequestDispatcher
public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
Checks to make sure the path to forward to is within the WEB-INF directory and then returns the dispatcher. Otherwise returns null.- Specified by:
getRequestDispatcherin interfacejavax.servlet.ServletRequest- Overrides:
getRequestDispatcherin classjavax.servlet.ServletRequestWrapper- Parameters:
path- The path to create a request dispatcher for- Returns:
- A
RequestDispatcherobject that acts as a wrapper for the resource at the specified path, or null if the servlet container cannot return aRequestDispatcher.
-
getRequestedSessionId
public java.lang.String getRequestedSessionId()
Returns the URI from the HttpServletRequest after canonicalizing and filtering out any dangerous characters. Code must be very careful not to depend on the value of a requested session id reported by the user.- Specified by:
getRequestedSessionIdin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getRequestedSessionIdin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The requested Session ID
-
getRequestURI
public java.lang.String getRequestURI()
Returns the URI from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getRequestURIin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getRequestURIin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The current request URI
-
getRequestURL
public java.lang.StringBuffer getRequestURL()
Returns the URL from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getRequestURLin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getRequestURLin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The currect request URL
-
getScheme
public java.lang.String getScheme()
Returns the scheme from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getSchemein interfacejavax.servlet.ServletRequest- Overrides:
getSchemein classjavax.servlet.ServletRequestWrapper- Returns:
- The scheme of the current request
-
getServerName
public java.lang.String getServerName()
Returns the server name (host header) from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getServerNamein interfacejavax.servlet.ServletRequest- Overrides:
getServerNamein classjavax.servlet.ServletRequestWrapper- Returns:
- The local server name
-
getServerPort
public int getServerPort()
Returns the server port (after the : in the host header) from the HttpServletRequest after parsing and checking the range 0-65536.- Specified by:
getServerPortin interfacejavax.servlet.ServletRequest- Overrides:
getServerPortin classjavax.servlet.ServletRequestWrapper- Returns:
- The local server port
-
getServletPath
public java.lang.String getServletPath()
Returns the server path from the HttpServletRequest after canonicalizing and filtering out any dangerous characters.- Specified by:
getServletPathin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getServletPathin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The servlet path
-
getSession
public javax.servlet.http.HttpSession getSession()
Returns a session, creating it if necessary, and sets the HttpOnly flag on the Session ID cookie. The 'secure' flag is also set if the propertyHttpUtilities.ForceSecureCookiesis set totruein the ESAPI.properties file.- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getSessionin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The current session
-
getSession
public javax.servlet.http.HttpSession getSession(boolean create)
Returns the current session associated with this request or, if there is no current session andcreateistrue, returns a new session and sets the HttpOnly flag on the session ID cookie. The 'secure' flag is also set if the propertyHttpUtilities.ForceSecureCookiesis set totruein the ESAPI.properties file.- Specified by:
getSessionin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getSessionin classjavax.servlet.http.HttpServletRequestWrapper- Parameters:
create- If set totrue, create a new session if one doesn't exist, otherwise returnnull- Returns:
- The current session
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
Returns the ESAPI User associated with this getHttpServletRequest().- Specified by:
getUserPrincipalin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getUserPrincipalin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- The ESAPI User
-
isRequestedSessionIdFromCookie
public boolean isRequestedSessionIdFromCookie()
Same as HttpServletRequest, no security changes required.- Specified by:
isRequestedSessionIdFromCookiein interfacejavax.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdFromCookiein classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- if requested session id is from a cookie
-
isRequestedSessionIdFromUrl
@Deprecated public boolean isRequestedSessionIdFromUrl()
Deprecated.in servlet spec 2.1. UseisRequestedSessionIdFromURL()instead.Same as HttpServletRequest, no security changes required.- Specified by:
isRequestedSessionIdFromUrlin interfacejavax.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdFromUrlin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- Whether the requested session id is from the URL
-
isRequestedSessionIdFromURL
public boolean isRequestedSessionIdFromURL()
Same as HttpServletRequest, no security changes required.- Specified by:
isRequestedSessionIdFromURLin interfacejavax.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdFromURLin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- Whether the requested session id is from the URL
-
isRequestedSessionIdValid
public boolean isRequestedSessionIdValid()
Same as HttpServletRequest, no security changes required.- Specified by:
isRequestedSessionIdValidin interfacejavax.servlet.http.HttpServletRequest- Overrides:
isRequestedSessionIdValidin classjavax.servlet.http.HttpServletRequestWrapper- Returns:
- Whether the requested session id is valid
-
isSecure
public boolean isSecure()
Same as HttpServletRequest, no security changes required.- Specified by:
isSecurein interfacejavax.servlet.ServletRequest- Overrides:
isSecurein classjavax.servlet.ServletRequestWrapper- Returns:
- Whether the current request is secure
-
isUserInRole
public boolean isUserInRole(java.lang.String role)
Returns true if the ESAPI User associated with this request has the specified role.- Specified by:
isUserInRolein interfacejavax.servlet.http.HttpServletRequest- Overrides:
isUserInRolein classjavax.servlet.http.HttpServletRequestWrapper- Parameters:
role- The role to check- Returns:
- Whether the current user is in the passed role
-
removeAttribute
public void removeAttribute(java.lang.String name)
Same as HttpServletRequest, no security changes required.- Specified by:
removeAttributein interfacejavax.servlet.ServletRequest- Overrides:
removeAttributein classjavax.servlet.ServletRequestWrapper- Parameters:
name- The attribute name
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object o)Same as HttpServletRequest, no security changes required.- Specified by:
setAttributein interfacejavax.servlet.ServletRequest- Overrides:
setAttributein classjavax.servlet.ServletRequestWrapper- Parameters:
name- The attribute nameo- The attribute value
-
setCharacterEncoding
public void setCharacterEncoding(java.lang.String enc) throws java.io.UnsupportedEncodingExceptionSets the character encoding scheme to the ESAPI configured encoding scheme.- Specified by:
setCharacterEncodingin interfacejavax.servlet.ServletRequest- Overrides:
setCharacterEncodingin classjavax.servlet.ServletRequestWrapper- Parameters:
enc- The encoding scheme- Throws:
java.io.UnsupportedEncodingException
-
getAllowableContentRoot
public java.lang.String getAllowableContentRoot()
-
setAllowableContentRoot
public void setAllowableContentRoot(java.lang.String allowableContentRoot)
-
-