クラス 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.Filterorg.springframework.beans.factory.Awareorg.springframework.beans.factory.BeanNameAwareorg.springframework.beans.factory.DisposableBeanorg.springframework.beans.factory.InitializingBeanorg.springframework.context.ApplicationEventPublisherAwareorg.springframework.context.EnvironmentAwareorg.springframework.core.env.EnvironmentCapableorg.springframework.web.context.ServletContextAware

public class RequestAttributeAuthenticationFilter extends AbstractPreAuthenticatedProcessingFilter
スタンフォード WebAuthShibboleth などの SSO システムで使用するために、リクエスト属性からユーザー名を取得する単純な事前認証済みフィルター。

ほとんどの事前認証シナリオと同様に、このフィルターは認証を一切行わないため、外部認証システムを正しくセットアップすることが不可欠です。

プロパティ principalEnvironmentVariable は、ユーザー名を含むリクエスト属性の名前です。WebAuth および Shibboleth との互換性のため、デフォルトは "REMOTE_USER" です。

環境変数がリクエストにない場合、getPreAuthenticatedPrincipal は例外をスローします。exceptionIfVariableMissing プロパティを設定することにより、この動作をオーバーライドできます。

導入:
4.2
  • コンストラクターの詳細

    • RequestAttributeAuthenticationFilter

      public RequestAttributeAuthenticationFilter()
  • メソッドの詳細

    • getPreAuthenticatedPrincipal

      protected ObjectSE getPreAuthenticatedPrincipal(jakarta.servlet.http.HttpServletRequest request)
      リクエストから principalEnvironmentVariable によって指定された変数を読み取り、返します。
      次で指定:
      クラス AbstractPreAuthenticatedProcessingFiltergetPreAuthenticatedPrincipal 
      例外:
      PreAuthenticatedCredentialsNotFoundException - 環境変数がなく、exceptionIfVariableMissing が true に設定されている場合
    • getPreAuthenticatedCredentials

      protected ObjectSE getPreAuthenticatedCredentials(jakarta.servlet.http.HttpServletRequest request)
      通常、資格情報は適用されませんが、credentialsEnvironmentVariable が設定されている場合、これが読み取られて資格情報の値として使用されます。それ以外の場合は、ダミー値が使用されます。
      次で指定:
      クラス AbstractPreAuthenticatedProcessingFiltergetPreAuthenticatedCredentials 
    • setPrincipalEnvironmentVariable

      public void setPrincipalEnvironmentVariable(StringSE principalEnvironmentVariable)
    • setCredentialsEnvironmentVariable

      public void setCredentialsEnvironmentVariable(StringSE credentialsEnvironmentVariable)
    • setExceptionIfVariableMissing

      public void setExceptionIfVariableMissing(boolean exceptionIfVariableMissing)
      プリンシパル変数が欠落している場合に例外を発生させるかどうかを定義します。デフォルトは true です。
      パラメーター:
      exceptionIfVariableMissing - false に設定すると、デフォルトの動作が上書きされ、変数が見つからない場合にリクエストを続行できます。