Spring Security

Spring Securityのまとめ。

概要

バージョン履歴

メジャー及びマイナーバージョンアップのみ記載。

バージョン リリース日 対応するJDK

v6.1.0

2023-11-16

JDK 17-23

v6.0.0

2022-11-16

JDK 17-21

機能概要

  • 認証

    • パスワード管理

  • 認可

  • 脆弱性対応

    • CSRF

    • HTTP Header

    • HTTP Requests

  • 統合

    • REST Client

    • Cyptography

    • Spring Data

    • Jackson

    • Localizaztion

対応可能認証

  • Form認証

  • Basic認証

  • Digest認証

  • パスキー

  • ワンタイムトークン

  • JAAS

  • CAS

  • X509

  • 周辺

    • 多要素認証

    • Remember Me

    • Anonymous

    • Pre-Authentication

    • ログアウト

    • 認証イベント

ロギング

logging.level.org.springframework.security=TRACE
@Configuration
@EnableWebSecurity(debug = true)
public class WebSecurityConfig {
}

デフォルト

Config

@Configuration
@EnableWebSecurity
public class WebSecurityConfig {

  @Bean
  public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
  	http
  		.authorizeHttpRequests((authorize) -> authorize
  			.anyRequest().authenticated()
  		)
  		.formLogin(Customizer.withDefaults())
  		.httpBasic(Customizer.withDefaults());
  	return http.build();
  }

}