クラス SecurityContextHolderAwareRequestWrapper
java.lang.ObjectSE
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper
- 実装されたすべてのインターフェース:
jakarta.servlet.http.HttpServletRequest
,jakarta.servlet.ServletRequest
public class SecurityContextHolderAwareRequestWrapper
extends jakarta.servlet.http.HttpServletRequestWrapper
Spring Security-aware
HttpServletRequestWrapper
。SecurityContext
-defined Authentication
オブジェクトを使用してサーブレット API のセキュリティメソッドを実装します。getUserPrincipal()
isUserInRole(String)
HttpServletRequestWrapper.getRemoteUser()
.
フィールドのサマリー
インターフェース jakarta.servlet.http.HttpServletRequest から継承されたフィールド
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
コンストラクターの概要
コンストラクターコンストラクター説明SecurityContextHolderAwareRequestWrapper
(jakarta.servlet.http.HttpServletRequest request, StringSE rolePrefix) AuthenticationTrustResolverImpl
で新しいインスタンスを作成します。SecurityContextHolderAwareRequestWrapper
(jakarta.servlet.http.HttpServletRequest request, AuthenticationTrustResolver trustResolver, StringSE rolePrefix) 新しいインスタンスを作成しますメソッドのサマリー
修飾子と型メソッド説明SecurityContextHolder
から取得したプリンシパルの名前を返します。Authentication
(Principal
のサブクラス)、または使用できない場合はnull
を返します。boolean
isUserInRole
(StringSE role) 正確に一致するGrantedAuthority.getAuthority()
を簡単に検索します。void
setSecurityContextHolderStrategy
(SecurityContextHolderStrategy securityContextHolderStrategy) 使用するSecurityContextHolderStrategy
を設定します。toString()
クラス jakarta.servlet.http.HttpServletRequestWrapper から継承されたメソッド
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, login, logout, newPushBuilder, upgrade
クラス jakarta.servlet.ServletRequestWrapper から継承されたメソッド
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsync
クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSE
インターフェース jakarta.servlet.ServletRequest から継承されたメソッド
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
コンストラクターの詳細
SecurityContextHolderAwareRequestWrapper
public SecurityContextHolderAwareRequestWrapper(jakarta.servlet.http.HttpServletRequest request, StringSE rolePrefix) AuthenticationTrustResolverImpl
で新しいインスタンスを作成します。- パラメーター:
request
-rolePrefix
-
SecurityContextHolderAwareRequestWrapper
public SecurityContextHolderAwareRequestWrapper(jakarta.servlet.http.HttpServletRequest request, AuthenticationTrustResolver trustResolver, StringSE rolePrefix) 新しいインスタンスを作成します- パラメーター:
request
- 元のHttpServletRequest
trustResolver
- 使用するAuthenticationTrustResolver
。null にはできません。rolePrefix
-isUserInRole(String)
に追加する接頭辞。接頭辞がない場合は null。
メソッドの詳細
getRemoteUser
SecurityContextHolder
から取得したプリンシパルの名前を返します。String
ベースとUserDetails
ベースの両方のプリンシパルを適切に処理します。- 次で指定:
- インターフェース
jakarta.servlet.http.HttpServletRequest
のgetRemoteUser
- オーバーライド:
- クラス
jakarta.servlet.http.HttpServletRequestWrapper
のgetRemoteUser
- 戻り値:
- ユーザー名または使用できない場合は
null
getUserPrincipal
Authentication
(Principal
のサブクラス)、または使用できない場合はnull
を返します。- 次で指定:
- インターフェース
jakarta.servlet.http.HttpServletRequest
のgetUserPrincipal
- オーバーライド:
- クラス
jakarta.servlet.http.HttpServletRequestWrapper
のgetUserPrincipal
- 戻り値:
Authentication
またはnull
isUserInRole
正確に一致するGrantedAuthority.getAuthority()
を簡単に検索します。SecurityContextHolder
にnull
principal
および / またはGrantedAuthority[]
オブジェクトを含むAuthentication
が含まれている場合、常にfalse
を返します。- 次で指定:
- インターフェース
jakarta.servlet.http.HttpServletRequest
のisUserInRole
- オーバーライド:
- クラス
jakarta.servlet.http.HttpServletRequestWrapper
のisUserInRole
- パラメーター:
role
- チェックするGrantedAuthority
String
表現- 戻り値:
- 正確な(大文字と小文字を区別する)一致する付与された権限が見つかった場合は
true
、それ以外の場合はfalse
toString
setSecurityContextHolderStrategy
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) 使用するSecurityContextHolderStrategy
を設定します。デフォルトのアクションは、SecurityContextHolder
に格納されているSecurityContextHolderStrategy
を使用することです。- 導入:
- 5.8