クラス ExceptionMappingAuthenticationFailureHandler

java.lang.ObjectSE
org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler
org.springframework.security.web.authentication.ExceptionMappingAuthenticationFailureHandler
実装されたすべてのインターフェース:
AuthenticationFailureHandler

public class ExceptionMappingAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler
例外型の内部マップを URL に使用して、認証失敗時の宛先を判別します。キーは完全な例外クラス名です。

一致が見つからない場合は、親クラス SimpleUrlAuthenticationFailureHandler の動作にフォールバックします。

例外名と URL のマップは、 exceptionMappings プロパティを設定することによって挿入する必要があります。

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

    • ExceptionMappingAuthenticationFailureHandler

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

    • onAuthenticationFailure

      public void onAuthenticationFailure(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AuthenticationException exception) throws IOExceptionSE, jakarta.servlet.ServletException
      クラスからコピーされた説明: SimpleUrlAuthenticationFailureHandler
      設定されている場合、defaultFailureUrl へのリダイレクトまたは転送を実行します。それ以外の場合は、401 エラーコードを返します。

      リダイレクトまたは転送する場合、saveException が呼び出され、例外をキャッシュしてターゲットビューで使用します。

      次で指定:
      インターフェース AuthenticationFailureHandleronAuthenticationFailure 
      オーバーライド:
      クラス SimpleUrlAuthenticationFailureHandleronAuthenticationFailure 
      パラメーター:
      request - 認証試行が発生したリクエスト。
      response - レスポンス。
      exception - 認証リクエストを拒否するためにスローされた例外。
      例外:
      IOExceptionSE
      jakarta.servlet.ServletException
    • setExceptionMappings

      public void setExceptionMappings(MapSE<?,?> failureUrlMap)
      例外型のマップを(名前で)URL に設定します。
      パラメーター:
      failureUrlMap - 例外クラスの完全修飾名をキーとし、対応する失敗 URL を値として持つマップ。
      例外:
      IllegalArgumentExceptionSE - エントリが文字列でない場合、または URL が無効な場合。