public class ShiroHttpServletRequest
extends javax.servlet.http.HttpServletRequestWrapper
ShiroHttpServletRequest
wraps the Servlet container's original ServletRequest
instance, but ensures
that all HttpServletRequest
invocations that require Shiro's support (getRemoteUser
,
getSession
, etc) can be executed first by Shiro as necessary before allowing the underlying
Servlet container instance's method to be invoked.Modifier and Type | Field and Description |
---|---|
static String |
COOKIE_SESSION_ID_SOURCE |
protected boolean |
httpSessions |
static String |
IDENTITY_REMOVED_KEY |
static String |
REFERENCED_SESSION_ID |
static String |
REFERENCED_SESSION_ID_IS_VALID |
static String |
REFERENCED_SESSION_ID_SOURCE |
static String |
REFERENCED_SESSION_IS_NEW |
protected javax.servlet.ServletContext |
servletContext |
protected javax.servlet.http.HttpSession |
session |
static String |
SESSION_ID_URL_REWRITING_ENABLED |
static String |
URL_SESSION_ID_SOURCE |
Constructor and Description |
---|
ShiroHttpServletRequest(javax.servlet.http.HttpServletRequest wrapped,
javax.servlet.ServletContext servletContext,
boolean httpSessions) |
Modifier and Type | Method and Description |
---|---|
String |
getRemoteUser() |
String |
getRequestedSessionId() |
javax.servlet.http.HttpSession |
getSession() |
javax.servlet.http.HttpSession |
getSession(boolean create) |
protected Subject |
getSubject() |
protected Object |
getSubjectPrincipal() |
Principal |
getUserPrincipal() |
boolean |
isHttpSessions() |
boolean |
isRequestedSessionIdFromCookie() |
boolean |
isRequestedSessionIdFromUrl() |
boolean |
isRequestedSessionIdFromURL() |
boolean |
isRequestedSessionIdValid() |
boolean |
isUserInRole(String s) |
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRequestURI, getRequestURL, getServletPath, login, logout, upgrade
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, startAsync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
public static final String COOKIE_SESSION_ID_SOURCE
public static final String URL_SESSION_ID_SOURCE
public static final String REFERENCED_SESSION_ID
public static final String REFERENCED_SESSION_ID_IS_VALID
public static final String REFERENCED_SESSION_IS_NEW
public static final String REFERENCED_SESSION_ID_SOURCE
public static final String IDENTITY_REMOVED_KEY
public static final String SESSION_ID_URL_REWRITING_ENABLED
protected javax.servlet.ServletContext servletContext
protected javax.servlet.http.HttpSession session
protected boolean httpSessions
public ShiroHttpServletRequest(javax.servlet.http.HttpServletRequest wrapped, javax.servlet.ServletContext servletContext, boolean httpSessions)
public boolean isHttpSessions()
public String getRemoteUser()
getRemoteUser
in interface javax.servlet.http.HttpServletRequest
getRemoteUser
in class javax.servlet.http.HttpServletRequestWrapper
protected Subject getSubject()
protected Object getSubjectPrincipal()
public boolean isUserInRole(String s)
isUserInRole
in interface javax.servlet.http.HttpServletRequest
isUserInRole
in class javax.servlet.http.HttpServletRequestWrapper
public Principal getUserPrincipal()
getUserPrincipal
in interface javax.servlet.http.HttpServletRequest
getUserPrincipal
in class javax.servlet.http.HttpServletRequestWrapper
public String getRequestedSessionId()
getRequestedSessionId
in interface javax.servlet.http.HttpServletRequest
getRequestedSessionId
in class javax.servlet.http.HttpServletRequestWrapper
public javax.servlet.http.HttpSession getSession(boolean create)
getSession
in interface javax.servlet.http.HttpServletRequest
getSession
in class javax.servlet.http.HttpServletRequestWrapper
public javax.servlet.http.HttpSession getSession()
getSession
in interface javax.servlet.http.HttpServletRequest
getSession
in class javax.servlet.http.HttpServletRequestWrapper
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdValid
in class javax.servlet.http.HttpServletRequestWrapper
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromCookie
in class javax.servlet.http.HttpServletRequestWrapper
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromURL
in class javax.servlet.http.HttpServletRequestWrapper
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface javax.servlet.http.HttpServletRequest
isRequestedSessionIdFromUrl
in class javax.servlet.http.HttpServletRequestWrapper
Copyright © 2004–2017 The Apache Software Foundation. All rights reserved.