クラス RequestAttributeAuthenticationFilter
java.lang.ObjectSE
org.springframework.web.filter.GenericFilterBean
org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter
org.springframework.security.web.authentication.preauth.RequestAttributeAuthenticationFilter
- 実装されたすべてのインターフェース:
jakarta.servlet.Filter
、org.springframework.beans.factory.Aware
、org.springframework.beans.factory.BeanNameAware
、org.springframework.beans.factory.DisposableBean
、org.springframework.beans.factory.InitializingBean
、org.springframework.context.ApplicationEventPublisherAware
、org.springframework.context.EnvironmentAware
、org.springframework.core.env.EnvironmentCapable
、org.springframework.web.context.ServletContextAware
スタンフォード WebAuth や Shibboleth などの SSO システムで使用するために、リクエスト属性からユーザー名を取得する単純な事前認証済みフィルター。
ほとんどの事前認証シナリオと同様に、このフィルターは認証を一切行わないため、外部認証システムを正しくセットアップすることが不可欠です。
プロパティ principalEnvironmentVariable
は、ユーザー名を含むリクエスト属性の名前です。WebAuth および Shibboleth との互換性のため、デフォルトは "REMOTE_USER" です。
環境変数がリクエストにない場合、getPreAuthenticatedPrincipal
は例外をスローします。exceptionIfVariableMissing
プロパティを設定することにより、この動作をオーバーライドできます。
- 導入:
- 4.2
フィールドサマリー
クラス org.springframework.web.filter.GenericFilterBean から継承されたフィールド
logger
コンストラクターのサマリー
コンストラクターメソッドのサマリー
修飾子と型メソッド説明protected ObjectSE
getPreAuthenticatedCredentials
(jakarta.servlet.http.HttpServletRequest request) 通常、資格情報は適用されませんが、credentialsEnvironmentVariable
が設定されている場合、これが読み取られて資格情報の値として使用されます。protected ObjectSE
getPreAuthenticatedPrincipal
(jakarta.servlet.http.HttpServletRequest request) リクエストからprincipalEnvironmentVariable
によって指定された変数を読み取り、返します。void
setCredentialsEnvironmentVariable
(StringSE credentialsEnvironmentVariable) void
setExceptionIfVariableMissing
(boolean exceptionIfVariableMissing) プリンシパル変数が欠落している場合に例外を発生させるかどうかを定義します。void
setPrincipalEnvironmentVariable
(StringSE principalEnvironmentVariable) クラス org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter から継承されたメソッド
afterPropertiesSet, doFilter, getAuthenticationDetailsSource, principalChanged, setApplicationEventPublisher, setAuthenticationDetailsSource, setAuthenticationFailureHandler, setAuthenticationManager, setAuthenticationSuccessHandler, setCheckForPrincipalChanges, setContinueFilterChainOnUnsuccessfulAuthentication, setInvalidateSessionOnPrincipalChange, setRequiresAuthenticationRequestMatcher, setSecurityContextHolderStrategy, setSecurityContextRepository, successfulAuthentication, unsuccessfulAuthentication
クラス org.springframework.web.filter.GenericFilterBean から継承されたメソッド
addRequiredProperty, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
コンストラクターの詳細
RequestAttributeAuthenticationFilter
public RequestAttributeAuthenticationFilter()
メソッドの詳細
getPreAuthenticatedPrincipal
リクエストからprincipalEnvironmentVariable
によって指定された変数を読み取り、返します。- 次で指定:
- クラス
AbstractPreAuthenticatedProcessingFilter
のgetPreAuthenticatedPrincipal
- 例外:
PreAuthenticatedCredentialsNotFoundException
- 環境変数がなく、exceptionIfVariableMissing
がtrue
に設定されている場合
getPreAuthenticatedCredentials
通常、資格情報は適用されませんが、credentialsEnvironmentVariable
が設定されている場合、これが読み取られて資格情報の値として使用されます。それ以外の場合は、ダミー値が使用されます。setPrincipalEnvironmentVariable
setCredentialsEnvironmentVariable
setExceptionIfVariableMissing
public void setExceptionIfVariableMissing(boolean exceptionIfVariableMissing) プリンシパル変数が欠落している場合に例外を発生させるかどうかを定義します。デフォルトはtrue
です。- パラメーター:
exceptionIfVariableMissing
-false
に設定すると、デフォルトの動作が上書きされ、変数が見つからない場合にリクエストを続行できます。