クラス 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) 新しいインスタンスを作成します方法の概要
修飾子と型メソッド説明@Nullable StringSESecurityContextHolderから取得したプリンシパルの名前を返します。@Nullable PrincipalSEAuthentication(Principalのサブクラス)、または使用できない場合はnullを返します。booleanisUserInRole(StringSE role) 正確に一致するGrantedAuthority.getAuthority()を簡単に検索します。voidsetSecurityContextHolderStrategy(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, 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, 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- 元のHttpServletRequesttrustResolver- 使用する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にnullprincipalおよび / またはGrantedAuthority[]オブジェクトを含むAuthenticationが含まれている場合、常にfalseを返します。- 次で指定:
- インターフェース
jakarta.servlet.http.HttpServletRequestのisUserInRole - オーバーライド:
- クラス
jakarta.servlet.http.HttpServletRequestWrapperのisUserInRole - パラメーター:
role- チェックするGrantedAuthorityString表現- 戻り値:
- 正確な(大文字と小文字を区別する)一致する付与された権限が見つかった場合は
true、それ以外の場合はfalse
toString
setSecurityContextHolderStrategy
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) 使用するSecurityContextHolderStrategyを設定します。デフォルトのアクションは、SecurityContextHolderに格納されているSecurityContextHolderStrategyを使用することです。- 導入:
- 5.8