public class RolesRequestWrapper
extends javax.servlet.http.HttpServletRequestWrapper
| Constructor and Description |
|---|
RolesRequestWrapper(javax.servlet.http.HttpServletRequest inRequest,
Principal inPrincipal,
String[] inRoles)
Create a wrapper with the given principal, role assigned to that
principal, and the original request.
|
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getRoles() |
Principal |
getUserPrincipal()
Returns the
Principal that was passed into the constructor. |
boolean |
isUserInRole(String inRole)
Checks if the given role is one of those that were passed into the
constructor.
|
authenticate, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, login, logoutgetAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, 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, startAsyncclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, 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, startAsyncpublic RolesRequestWrapper(javax.servlet.http.HttpServletRequest inRequest,
Principal inPrincipal,
String[] inRoles)
inRequest - The original request. Cannot be null.inPrincipal - The request principal. Cannot be null.inRoles - The roles assigned to the principal.public boolean isUserInRole(String inRole)
null passed in for roles, it checks
the request that was passed into the constructor instead.isUserInRole in interface javax.servlet.http.HttpServletRequestisUserInRole in class javax.servlet.http.HttpServletRequestWrapperinRole - a role.true or false.public Principal getUserPrincipal()
Principal that was passed into the constructor. If
null was passed into the constructor, it tries getting
the Principal from the request that was passed into the constructor.getUserPrincipal in interface javax.servlet.http.HttpServletRequestgetUserPrincipal in class javax.servlet.http.HttpServletRequestWrapperCopyright © 2016–2019 Emory University. All rights reserved.