Package org.apache.wiki.ui
Class WikiRequestWrapper
java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
org.apache.wiki.ui.WikiRequestWrapper
- All Implemented Interfaces:
javax.servlet.http.HttpServletRequest,javax.servlet.ServletRequest
public class WikiRequestWrapper extends javax.servlet.http.HttpServletRequestWrapper
Servlet request wrapper that encapsulates an incoming HTTP request and overrides its security methods so that the request returns
JSPWiki-specific values.
- Since:
- 2.8
-
Field Summary
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Constructor Summary
Constructors Constructor Description WikiRequestWrapper(Engine engine, javax.servlet.http.HttpServletRequest request)Constructs a new wrapped request. -
Method Summary
Modifier and Type Method Description java.lang.StringgetRemoteUser()Returns the remote user for the HTTP request, taking into account both container and JSPWiki custom authentication status.java.security.PrincipalgetUserPrincipal()Returns the user principal for the HTTP request, taking into account both container and JSPWiki custom authentication status.booleanisUserInRole(java.lang.String role)Determines whether the current user possesses a supplied role, taking into account both container and JSPWIki custom authentication status.Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, login, logout, upgradeMethods inherited from class javax.servlet.ServletRequestWrapper
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
Constructor Details
-
WikiRequestWrapper
Constructs a new wrapped request.- Parameters:
engine- the wiki enginerequest- the request to wrap
-
-
Method Details
-
getRemoteUser
Returns the remote user for the HTTP request, taking into account both container and JSPWiki custom authentication status. Specifically, if the wrapped request contains a remote user, this method returns that remote user. Otherwise, if the user's Session is an authenticated session (that is,Session.isAuthenticated()returnstrue, this method returns the name of the principal returned bySession.getLoginPrincipal().- Specified by:
getRemoteUserin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getRemoteUserin classjavax.servlet.http.HttpServletRequestWrapper
-
getUserPrincipal
Returns the user principal for the HTTP request, taking into account both container and JSPWiki custom authentication status. Specifically, if the wrapped request contains a user principal, this method returns that principal. Otherwise, if the user's Session is an authenticated session (that is,Session.isAuthenticated()returnstrue, this method returns the value ofSession.getLoginPrincipal().- Specified by:
getUserPrincipalin interfacejavax.servlet.http.HttpServletRequest- Overrides:
getUserPrincipalin classjavax.servlet.http.HttpServletRequestWrapper
-
isUserInRole
Determines whether the current user possesses a supplied role, taking into account both container and JSPWIki custom authentication status. Specifically, if the wrapped request shows that the user possesses the role, this method returnstrue. If not, this method iterates through the built-in Role objects (e.g., ANONYMOUS, ASSERTED, AUTHENTICATED) returned bySession.getRoles()and checks to see if any of these principals' names match the supplied role.- Specified by:
isUserInRolein interfacejavax.servlet.http.HttpServletRequest- Overrides:
isUserInRolein classjavax.servlet.http.HttpServletRequestWrapper
-