public class SecurityWrapperRequest
extends javax.servlet.http.HttpServletRequestWrapper
implements javax.servlet.http.HttpServletRequest
| Constructor and Description |
|---|
SecurityWrapperRequest(javax.servlet.http.HttpServletRequest request)
Construct a safe request that overrides the default request methods with
safer versions.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getAllowableContentRoot() |
Object |
getAttribute(String name)
Same as HttpServletRequest, no security changes required.
|
Enumeration |
getAttributeNames()
Same as HttpServletRequest, no security changes required.
|
String |
getAuthType()
Same as HttpServletRequest, no security changes required.
|
String |
getCharacterEncoding()
Same as HttpServletRequest, no security changes required.
|
int |
getContentLength()
Same as HttpServletRequest, no security changes required.
|
String |
getContentType()
Same as HttpServletRequest, no security changes required.
|
String |
getContextPath()
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.
|
long |
getDateHeader(String name)
Same as HttpServletRequest, no security changes required.
|
String |
getHeader(String name)
Returns the named header from the HttpServletRequest after canonicalizing
and filtering out any dangerous characters.
|
Enumeration |
getHeaderNames()
Returns the enumeration of header names from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
Enumeration |
getHeaders(String name)
Returns the enumeration of headers from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
javax.servlet.ServletInputStream |
getInputStream()
Same as HttpServletRequest, no security changes required.
|
int |
getIntHeader(String name)
Same as HttpServletRequest, no security changes required.
|
String |
getLocalAddr()
Same as HttpServletRequest, no security changes required.
|
Locale |
getLocale()
Same as HttpServletRequest, no security changes required.
|
Enumeration |
getLocales()
Same as HttpServletRequest, no security changes required.
|
String |
getLocalName()
Same as HttpServletRequest, no security changes required.
|
int |
getLocalPort()
Same as HttpServletRequest, no security changes required.
|
String |
getMethod()
Same as HttpServletRequest, no security changes required.
|
String |
getParameter(String name)
Returns the named parameter from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
String |
getParameter(String name,
boolean allowNull)
Returns the named parameter from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
String |
getParameter(String name,
boolean allowNull,
int maxLength)
Returns the named parameter from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
String |
getParameter(String name,
boolean allowNull,
int maxLength,
String regexName)
Returns the named parameter from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
Map |
getParameterMap()
Returns the parameter map from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
Enumeration |
getParameterNames()
Returns the enumeration of parameter names from the HttpServletRequest
after canonicalizing and filtering out any dangerous characters.
|
String[] |
getParameterValues(String name)
Returns the array of matching parameter values from the
HttpServletRequest after canonicalizing and filtering out any dangerous
characters.
|
String |
getPathInfo()
Returns the path info from the HttpServletRequest after canonicalizing
and filtering out any dangerous characters.
|
String |
getPathTranslated()
Same as HttpServletRequest, no security changes required.
|
String |
getProtocol()
Same as HttpServletRequest, no security changes required.
|
String |
getQueryString()
Returns the query string from the HttpServletRequest after canonicalizing
and filtering out any dangerous characters.
|
BufferedReader |
getReader()
Same as HttpServletRequest, no security changes required.
|
String |
getRealPath(String path)
Deprecated.
in servlet spec 2.1. Use
ServletContext.getRealPath(String) instead. |
String |
getRemoteAddr()
Same as HttpServletRequest, no security changes required.
|
String |
getRemoteHost()
Same as HttpServletRequest, no security changes required.
|
int |
getRemotePort()
Same as HttpServletRequest, no security changes required.
|
String |
getRemoteUser()
Returns the name of the ESAPI user associated with this getHttpServletRequest().
|
javax.servlet.RequestDispatcher |
getRequestDispatcher(String path)
Checks to make sure the path to forward to is within the WEB-INF
directory and then returns the dispatcher.
|
String |
getRequestedSessionId()
Returns the URI from the HttpServletRequest after canonicalizing and
filtering out any dangerous characters.
|
String |
getRequestURI()
Returns the URI from the HttpServletRequest after canonicalizing and
filtering out any dangerous characters.
|
StringBuffer |
getRequestURL()
Returns the URL from the HttpServletRequest after canonicalizing and
filtering out any dangerous characters.
|
String |
getScheme()
Returns the scheme from the HttpServletRequest after canonicalizing and
filtering out any dangerous characters.
|
String |
getServerName()
Returns the server name (host header) from the HttpServletRequest after
canonicalizing and filtering out any dangerous characters.
|
int |
getServerPort()
Returns the server port (after the : in the host header) from the
HttpServletRequest after parsing and checking the range 0-65536.
|
String |
getServletPath()
Returns the server path from the HttpServletRequest after canonicalizing
and filtering out any dangerous characters.
|
javax.servlet.http.HttpSession |
getSession()
Returns a session, creating it if necessary, and sets the HttpOnly flag
on the Session ID cookie.
|
javax.servlet.http.HttpSession |
getSession(boolean create)
Returns a session, creating it if necessary, and sets the HttpOnly flag
on the Session ID cookie.
|
Principal |
getUserPrincipal()
Returns the ESAPI User associated with this getHttpServletRequest().
|
boolean |
isRequestedSessionIdFromCookie()
Same as HttpServletRequest, no security changes required.
|
boolean |
isRequestedSessionIdFromUrl()
Deprecated.
in servlet spec 2.1. Use
isRequestedSessionIdFromURL() instead. |
boolean |
isRequestedSessionIdFromURL()
Same as HttpServletRequest, no security changes required.
|
boolean |
isRequestedSessionIdValid()
Same as HttpServletRequest, no security changes required.
|
boolean |
isSecure()
Same as HttpServletRequest, no security changes required.
|
boolean |
isUserInRole(String role)
Returns true if the ESAPI User associated with this request has the
specified role.
|
void |
removeAttribute(String name)
Same as HttpServletRequest, no security changes required.
|
void |
setAllowableContentRoot(String allowableContentRoot) |
void |
setAttribute(String name,
Object o)
Same as HttpServletRequest, no security changes required.
|
void |
setCharacterEncoding(String enc)
Sets the character encoding scheme to the ESAPI configured encoding scheme.
|
public SecurityWrapperRequest(javax.servlet.http.HttpServletRequest request)
request - The HttpServletRequest we are wrapping.public Object getAttribute(String name)
getAttribute in interface javax.servlet.ServletRequestgetAttribute in class javax.servlet.ServletRequestWrappername - The attribute namepublic Enumeration getAttributeNames()
getAttributeNames in interface javax.servlet.ServletRequestgetAttributeNames in class javax.servlet.ServletRequestWrapperEnumeration of attribute names.public String getAuthType()
getAuthType in interface javax.servlet.http.HttpServletRequestgetAuthType in class javax.servlet.http.HttpServletRequestWrapperpublic String getCharacterEncoding()
getCharacterEncoding in interface javax.servlet.ServletRequestgetCharacterEncoding in class javax.servlet.ServletRequestWrapperHttpServletRequestpublic int getContentLength()
getContentLength in interface javax.servlet.ServletRequestgetContentLength in class javax.servlet.ServletRequestWrapperHttpServletRequestpublic String getContentType()
getContentType in interface javax.servlet.ServletRequestgetContentType in class javax.servlet.ServletRequestWrapperHttpServletRequestpublic String getContextPath()
getContextPath in interface javax.servlet.http.HttpServletRequestgetContextPath in class javax.servlet.http.HttpServletRequestWrapperHttpServletRequestpublic javax.servlet.http.Cookie[] getCookies()
getCookies in interface javax.servlet.http.HttpServletRequestgetCookies in class javax.servlet.http.HttpServletRequestWrapperCookies for this HttpServletRequestpublic long getDateHeader(String name)
getDateHeader in interface javax.servlet.http.HttpServletRequestgetDateHeader in class javax.servlet.http.HttpServletRequestWrappername - Specifies the name of the HTTP request header; e.g.,
If-Modified-Since.January 1, 1970 GMT,
or -1 if the named header was not included with the request.public String getHeader(String name)
getHeader in interface javax.servlet.http.HttpServletRequestgetHeader in class javax.servlet.http.HttpServletRequestWrappername - The name of an HTTP request headerpublic Enumeration getHeaderNames()
getHeaderNames in interface javax.servlet.http.HttpServletRequestgetHeaderNames in class javax.servlet.http.HttpServletRequestWrapperEnumeration of header names associated with this request.public Enumeration getHeaders(String name)
getHeaders in interface javax.servlet.http.HttpServletRequestgetHeaders in class javax.servlet.http.HttpServletRequestWrappername - The name of an HTTP request header.Enumeration of headers from the request after
canonicalizing and filtering has been performed.public javax.servlet.ServletInputStream getInputStream()
throws IOException
getInputStream in interface javax.servlet.ServletRequestgetInputStream in class javax.servlet.ServletRequestWrapperServletInputStream associated with this
HttpServletRequest.IOException - Thrown if an input exception is thrown, such as the
remote peer closing the connection.public int getIntHeader(String name)
getIntHeader in interface javax.servlet.http.HttpServletRequestgetIntHeader in class javax.servlet.http.HttpServletRequestWrappername - The name of an HTTP request header.int.public String getLocalAddr()
getLocalAddr in interface javax.servlet.ServletRequestgetLocalAddr in class javax.servlet.ServletRequestWrapperString containing the IP address on which the
request was received.public Locale getLocale()
getLocale in interface javax.servlet.ServletRequestgetLocale in class javax.servlet.ServletRequestWrapperLocale for the client.public Enumeration getLocales()
getLocales in interface javax.servlet.ServletRequestgetLocales in class javax.servlet.ServletRequestWrapperEnumeration of preferred Locale
objects for the client.public String getLocalName()
getLocalName in interface javax.servlet.ServletRequestgetLocalName in class javax.servlet.ServletRequestWrapperString containing the host name of the IP on which
the request was received.public int getLocalPort()
getLocalPort in interface javax.servlet.ServletRequestgetLocalPort in class javax.servlet.ServletRequestWrapperpublic String getMethod()
getMethod in interface javax.servlet.http.HttpServletRequestgetMethod in class javax.servlet.http.HttpServletRequestWrapperpublic String getParameter(String name)
getParameter in interface javax.servlet.ServletRequestgetParameter in class javax.servlet.ServletRequestWrappername - The parameter name for the requestpublic String getParameter(String name, boolean allowNull)
name - The parameter name for the requestallowNull - Whether null values are allowedpublic String getParameter(String name, boolean allowNull, int maxLength)
name - The parameter name for the requestallowNull - Whether null values are allowedmaxLength - The maximum length allowedpublic String getParameter(String name, boolean allowNull, int maxLength, String regexName)
name - The parameter name for the requestallowNull - Whether null values are allowedmaxLength - The maximum length allowedregexName - The name of the regex mapped from ESAPI.propertiespublic Map getParameterMap()
getParameterMap in interface javax.servlet.ServletRequestgetParameterMap in class javax.servlet.ServletRequestWrapperMap containing scrubbed parameter names / value pairs.public Enumeration getParameterNames()
getParameterNames in interface javax.servlet.ServletRequestgetParameterNames in class javax.servlet.ServletRequestWrapperEnumeration of properly "scrubbed" parameter names.public String[] getParameterValues(String name)
getParameterValues in interface javax.servlet.ServletRequestgetParameterValues in class javax.servlet.ServletRequestWrappername - The parameter namenull if the parameter does not exist.public String getPathInfo()
getPathInfo in interface javax.servlet.http.HttpServletRequestgetPathInfo in class javax.servlet.http.HttpServletRequestWrapperpublic String getPathTranslated()
getPathTranslated in interface javax.servlet.http.HttpServletRequestgetPathTranslated in class javax.servlet.http.HttpServletRequestWrapperpublic String getProtocol()
getProtocol in interface javax.servlet.ServletRequestgetProtocol in class javax.servlet.ServletRequestWrapperpublic String getQueryString()
getQueryString in interface javax.servlet.http.HttpServletRequestgetQueryString in class javax.servlet.http.HttpServletRequestWrapperpublic BufferedReader getReader() throws IOException
getReader in interface javax.servlet.ServletRequestgetReader in class javax.servlet.ServletRequestWrapperBufferedReader containing the body of the request.IOException - If an input error occurred while reading the request
body (e.g., premature EOF).@Deprecated public String getRealPath(String path)
ServletContext.getRealPath(String) instead.getRealPath in interface javax.servlet.ServletRequestgetRealPath in class javax.servlet.ServletRequestWrapperpath - A virtual path on a web or application server; e.g., "/index.htm".public String getRemoteAddr()
getRemoteAddr in interface javax.servlet.ServletRequestgetRemoteAddr in class javax.servlet.ServletRequestWrapperpublic String getRemoteHost()
getRemoteHost in interface javax.servlet.ServletRequestgetRemoteHost in class javax.servlet.ServletRequestWrapperpublic int getRemotePort()
getRemotePort in interface javax.servlet.ServletRequestgetRemotePort in class javax.servlet.ServletRequestWrapperpublic String getRemoteUser()
getRemoteUser in interface javax.servlet.http.HttpServletRequestgetRemoteUser in class javax.servlet.http.HttpServletRequestWrapperpublic javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface javax.servlet.ServletRequestgetRequestDispatcher in class javax.servlet.ServletRequestWrapperpath - The path to create a request dispatcher forRequestDispatcher object that acts as a wrapper for the
resource at the specified path, or null if the servlet container
cannot return a RequestDispatcher.public String getRequestedSessionId()
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestgetRequestedSessionId in class javax.servlet.http.HttpServletRequestWrapperpublic String getRequestURI()
getRequestURI in interface javax.servlet.http.HttpServletRequestgetRequestURI in class javax.servlet.http.HttpServletRequestWrapperpublic StringBuffer getRequestURL()
getRequestURL in interface javax.servlet.http.HttpServletRequestgetRequestURL in class javax.servlet.http.HttpServletRequestWrapperpublic String getScheme()
getScheme in interface javax.servlet.ServletRequestgetScheme in class javax.servlet.ServletRequestWrapperpublic String getServerName()
getServerName in interface javax.servlet.ServletRequestgetServerName in class javax.servlet.ServletRequestWrapperpublic int getServerPort()
getServerPort in interface javax.servlet.ServletRequestgetServerPort in class javax.servlet.ServletRequestWrapperpublic String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestgetServletPath in class javax.servlet.http.HttpServletRequestWrapperpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestgetSession in class javax.servlet.http.HttpServletRequestWrapperpublic javax.servlet.http.HttpSession getSession(boolean create)
getSession in interface javax.servlet.http.HttpServletRequestgetSession in class javax.servlet.http.HttpServletRequestWrappercreate - Create a new session if one doesn't existpublic Principal getUserPrincipal()
getUserPrincipal in interface javax.servlet.http.HttpServletRequestgetUserPrincipal in class javax.servlet.http.HttpServletRequestWrapperpublic boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequestisRequestedSessionIdFromCookie in class javax.servlet.http.HttpServletRequestWrapper@Deprecated public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromURL() instead.isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequestisRequestedSessionIdFromUrl in class javax.servlet.http.HttpServletRequestWrapperpublic boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequestisRequestedSessionIdFromURL in class javax.servlet.http.HttpServletRequestWrapperpublic boolean isRequestedSessionIdValid()
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequestisRequestedSessionIdValid in class javax.servlet.http.HttpServletRequestWrapperpublic boolean isSecure()
isSecure in interface javax.servlet.ServletRequestisSecure in class javax.servlet.ServletRequestWrapperpublic boolean isUserInRole(String role)
isUserInRole in interface javax.servlet.http.HttpServletRequestisUserInRole in class javax.servlet.http.HttpServletRequestWrapperrole - The role to checkpublic void removeAttribute(String name)
removeAttribute in interface javax.servlet.ServletRequestremoveAttribute in class javax.servlet.ServletRequestWrappername - The attribute namepublic void setAttribute(String name, Object o)
setAttribute in interface javax.servlet.ServletRequestsetAttribute in class javax.servlet.ServletRequestWrappername - The attribute nameo - The attribute valuepublic void setCharacterEncoding(String enc) throws UnsupportedEncodingException
setCharacterEncoding in interface javax.servlet.ServletRequestsetCharacterEncoding in class javax.servlet.ServletRequestWrapperenc - The encoding schemeUnsupportedEncodingExceptionpublic String getAllowableContentRoot()
public void setAllowableContentRoot(String allowableContentRoot)
Copyright © 2016 The Open Web Application Security Project (OWASP). All rights reserved.