クラス SecurityContextHolderFilter

  • 実装されたすべてのインターフェース:
    javax.servlet.Filterorg.springframework.beans.factory.Awareorg.springframework.beans.factory.BeanNameAwareorg.springframework.beans.factory.DisposableBeanorg.springframework.beans.factory.InitializingBeanorg.springframework.context.EnvironmentAwareorg.springframework.core.env.EnvironmentCapableorg.springframework.web.context.ServletContextAware

    public class SecurityContextHolderFilter
    extends org.springframework.web.filter.OncePerRequestFilter
    SecurityContextRepository を使用して SecurityContext を取得し、それを SecurityContextHolder に設定する Filter。これは SecurityContextPersistenceFilter に似ていますが、SecurityContext を保存するために SecurityContextRepository.saveContext(SecurityContext, HttpServletRequest, HttpServletResponse) を明示的に呼び出す必要がある点が異なります。これにより、認証を永続化する必要があるかどうかをさまざまな認証メカニズムで個別に選択できるようになるため、効率が向上し、柔軟性が向上します。
    導入:
    5.7
    • フィールドサマリー

      • クラス org.springframework.web.filter.OncePerRequestFilter から継承されたフィールド

        ALREADY_FILTERED_SUFFIX
      • クラス org.springframework.web.filter.GenericFilterBean から継承されたフィールド

        logger
    • メソッドのサマリー

      すべてのメソッド   インスタンスメソッド   具象メソッド  
      修飾子と型 メソッド 説明
      protected voiddoFilterInternal​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain filterChain)
      voidsetShouldNotFilterErrorDispatch​(boolean shouldNotFilterErrorDispatch)
      エラーディスパッチの SecurityContextHolderFilter を無効にします。
      protected booleanshouldNotFilterErrorDispatch()
      • クラス org.springframework.web.filter.OncePerRequestFilter から継承されたメソッド

        doFilter, doFilterNestedErrorDispatch, getAlreadyFilteredAttributeName, isAsyncDispatch, isAsyncStarted, shouldNotFilter, shouldNotFilterAsyncDispatch
      • クラス org.springframework.web.filter.GenericFilterBean から継承されたメソッド

        addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
      • クラス java.lang.Object から継承されたメソッド

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • コンストラクターの詳細

      • SecurityContextHolderFilter

        public SecurityContextHolderFilter​(SecurityContextRepository securityContextRepository)
        新しいインスタンスを作成します。
        パラメーター:
        securityContextRepository - 使用するリポジトリ。null にすることはできません。
    • メソッドの詳細

      • doFilterInternal

        protected void doFilterInternal​(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        javax.servlet.FilterChain filterChain)
                                 throws javax.servlet.ServletException,
                                        java.io.IOException
        次で指定:
        クラス org.springframework.web.filter.OncePerRequestFilterdoFilterInternal 
        例外:
        javax.servlet.ServletException
        java.io.IOException
      • shouldNotFilterErrorDispatch

        protected boolean shouldNotFilterErrorDispatch()
        オーバーライド:
        クラス org.springframework.web.filter.OncePerRequestFiltershouldNotFilterErrorDispatch 
      • setShouldNotFilterErrorDispatch

        public void setShouldNotFilterErrorDispatch​(boolean shouldNotFilterErrorDispatch)
        エラーディスパッチの SecurityContextHolderFilter を無効にします。
        パラメーター:
        shouldNotFilterErrorDispatch - エラーディスパッチのためにフィルターを無効にする必要がある場合。デフォルトは false です。