クラス ExceptionHandlingConfigurer<H extends HttpSecurityBuilder<H>>
java.lang.ObjectSE
org.springframework.security.config.annotation.SecurityConfigurerAdapter<DefaultSecurityFilterChain,B>
org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer < ExceptionHandlingConfigurer <H>、H>
org.springframework.security.config.annotation.web.configurers.ExceptionHandlingConfigurer<H>
- 実装されているすべてのインターフェース:
SecurityConfigurer<DefaultSecurityFilterChain,H>
public final class ExceptionHandlingConfigurer<H extends HttpSecurityBuilder<H>>
extends AbstractHttpConfigurer<ExceptionHandlingConfigurer<H>,H>
Spring Security 関連の例外の例外処理をアプリケーションに追加します。すべてのプロパティには適切なデフォルトがあるため、この
SecurityConfigurer を適用する以外に追加の構成は必要ありません。セキュリティフィルター
次のフィルターが読み込まれます作成された共有オブジェクト
共有オブジェクトは作成されません。使用される共有オブジェクト
次の共有オブジェクトが使用されます。- 明示的な
RequestCacheが提供されない場合、RequestCache共有オブジェクトを使用して、認証が成功した後にリクエストを再生します AuthenticationEntryPoint-authenticationEntryPoint(AuthenticationEntryPoint)を参照
- 導入:
- 3.2
コンストラクターの概要
コンストラクター方法の概要
修飾子と型メソッド説明accessDeniedHandler(AccessDeniedHandler accessDeniedHandler) 使用するAccessDeniedHandlerを指定しますaccessDeniedPage(StringSE accessDeniedUrl) 使用するAccessDeniedHandlerを指定するショートカットは特定のエラーページですauthenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint) 使用するAuthenticationEntryPointを設定します。voidSecurityBuilderに必要なプロパティを設定して、SecurityBuilderを構成します。defaultAccessDeniedHandlerFor(AccessDeniedHandler deniedHandler, RequestMatcher preferredMatcher) 指定されたRequestMatcherに対して呼び出されることを優先するデフォルトのAccessDeniedHandlerを使用するように設定します。defaultAuthenticationEntryPointFor(AuthenticationEntryPoint entryPoint, RequestMatcher preferredMatcher) 指定されたRequestMatcherに対して呼び出されることを優先するデフォルトのAuthenticationEntryPointを使用するように設定します。defaultDeniedHandlerForMissingAuthority(ConsumerSE<DelegatingAuthenticationEntryPoint.Builder> entryPoint, StringSE authority) 指定された欠落しているGrantedAuthorityの代わりに呼び出されるデフォルトのAuthenticationEntryPointを設定します。defaultDeniedHandlerForMissingAuthority(AuthenticationEntryPoint entryPoint, StringSE authority) 指定された欠落しているGrantedAuthorityの代わりに呼び出されるデフォルトのAuthenticationEntryPointを設定します。クラス org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer から継承されたメソッド
disable, getRequestMatcherBuilder, getSecurityContextHolderStrategy, withObjectPostProcessorクラス org.springframework.security.config.annotation.SecurityConfigurerAdapter から継承されたメソッド
addObjectPostProcessor, getBuilder, init, postProcess, setBuilder
コンストラクターの詳細
ExceptionHandlingConfigurer
public ExceptionHandlingConfigurer()新しいインスタンスを作成します
メソッドの詳細
accessDeniedPage
使用するAccessDeniedHandlerを指定するショートカットは特定のエラーページです- パラメーター:
accessDeniedUrl- アクセス拒否ページの URL (つまり、/errors/401)- 戻り値:
- さらにカスタマイズするための
ExceptionHandlingConfigurer - 関連事項:
accessDeniedHandler
使用するAccessDeniedHandlerを指定します- パラメーター:
accessDeniedHandler- 使用するAccessDeniedHandler- 戻り値:
- さらにカスタマイズするための
ExceptionHandlingConfigurer
defaultAccessDeniedHandlerFor
public ExceptionHandlingConfigurer<H> defaultAccessDeniedHandlerFor(AccessDeniedHandler deniedHandler, RequestMatcher preferredMatcher) 使用するデフォルトのAccessDeniedHandlerを設定します。これは、提供されたRequestMatcherに対して呼び出されることを優先します。デフォルトのAccessDeniedHandlerが 1 つだけ指定されている場合は、デフォルトのAccessDeniedHandlerに使用されます。複数のデフォルトAccessDeniedHandlerインスタンスが構成されている場合、RequestMatcherDelegatingAccessDeniedHandlerが使用されます。- パラメーター:
deniedHandler- 使用するAccessDeniedHandlerpreferredMatcher- このデフォルトAccessDeniedHandlerのRequestMatcher- 戻り値:
- さらにカスタマイズするための
ExceptionHandlingConfigurer - 導入:
- 5.1
defaultDeniedHandlerForMissingAuthority
public ExceptionHandlingConfigurer<H> defaultDeniedHandlerForMissingAuthority(AuthenticationEntryPoint entryPoint, StringSE authority) 指定された欠落しているGrantedAuthorityの代わりに呼び出されるデフォルトのAuthenticationEntryPointを設定します。- パラメーター:
entryPoint- 指定されたauthorityに使用するAuthenticationEntryPointauthority- 権威- 戻り値:
- さらにカスタマイズするための
ExceptionHandlingConfigurer - 導入:
- 7.0
defaultDeniedHandlerForMissingAuthority
public ExceptionHandlingConfigurer<H> defaultDeniedHandlerForMissingAuthority(ConsumerSE<DelegatingAuthenticationEntryPoint.Builder> entryPoint, StringSE authority) 指定された欠落しているGrantedAuthorityの代わりに呼び出されるデフォルトのAuthenticationEntryPointを設定します。- パラメーター:
entryPoint- 指定されたauthorityに使用するDelegatingAuthenticationEntryPoint.Builderのコンシューマーauthority- 権威- 戻り値:
- さらにカスタマイズするための
ExceptionHandlingConfigurer - 導入:
- 7.0
authenticationEntryPoint
public ExceptionHandlingConfigurer<H> authenticationEntryPoint(AuthenticationEntryPoint authenticationEntryPoint) 使用するAuthenticationEntryPointを設定します。authenticationEntryPoint(AuthenticationEntryPoint)が指定されていない場合は、defaultAuthenticationEntryPointFor(AuthenticationEntryPoint, RequestMatcher)が使用されます。一致が見つからなかった場合、最初のAuthenticationEntryPointがデフォルトとして使用されます。それが提供されない場合、デフォルトは
Http403ForbiddenEntryPointになります。- パラメーター:
authenticationEntryPoint- 使用するAuthenticationEntryPoint- 戻り値:
- さらにカスタマイズするための
ExceptionHandlingConfigurer
defaultAuthenticationEntryPointFor
public ExceptionHandlingConfigurer<H> defaultAuthenticationEntryPointFor(AuthenticationEntryPoint entryPoint, RequestMatcher preferredMatcher) 使用するデフォルトのAuthenticationEntryPointを設定します。これは、提供されたRequestMatcherに対して呼び出されることを優先します。デフォルトのAuthenticationEntryPointが 1 つだけ指定されている場合は、デフォルトのAuthenticationEntryPointに使用されます。複数のデフォルトAuthenticationEntryPointインスタンスが構成されている場合、DelegatingAuthenticationEntryPointが使用されます。- パラメーター:
entryPoint- 使用するAuthenticationEntryPointpreferredMatcher- このデフォルトAuthenticationEntryPointのRequestMatcher- 戻り値:
- さらにカスタマイズするための
ExceptionHandlingConfigurer
configure
インターフェースからコピーされた説明:SecurityConfigurerSecurityBuilderに必要なプロパティを設定して、SecurityBuilderを構成します。- 次で指定:
- インターフェース
SecurityConfigurer<DefaultSecurityFilterChain,のH extends HttpSecurityBuilder<H>> configure - オーバーライド:
- クラス
SecurityConfigurerAdapter<DefaultSecurityFilterChain,のH extends HttpSecurityBuilder<H>> configure