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