|
@@ -35,19 +35,19 @@ import javax.servlet.http.HttpServletRequest
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * authorizeRequests {
|
|
|
- * authorize("/public", permitAll)
|
|
|
- * authorize(anyRequest, authenticated)
|
|
|
- * }
|
|
|
- * formLogin {
|
|
|
- * loginPage = "/log-in"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * authorizeRequests {
|
|
|
+ * authorize("/public", permitAll)
|
|
|
+ * authorize(anyRequest, authenticated)
|
|
|
+ * }
|
|
|
+ * formLogin {
|
|
|
+ * loginPage = "/log-in"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -87,16 +87,16 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * securityMatcher("/private/**")
|
|
|
- * formLogin {
|
|
|
- * loginPage = "/log-in"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * securityMatcher("/private/**")
|
|
|
+ * formLogin {
|
|
|
+ * loginPage = "/log-in"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -129,16 +129,16 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * securityMatcher(AntPathRequestMatcher("/private/**"))
|
|
|
- * formLogin {
|
|
|
- * loginPage = "/log-in"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * securityMatcher(AntPathRequestMatcher("/private/**"))
|
|
|
+ * formLogin {
|
|
|
+ * loginPage = "/log-in"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -160,15 +160,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * formLogin {
|
|
|
- * loginPage = "/log-in"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * formLogin {
|
|
|
+ * loginPage = "/log-in"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -190,16 +190,16 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * authorizeRequests {
|
|
|
- * authorize("/public", permitAll)
|
|
|
- * authorize(anyRequest, authenticated)
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * authorizeRequests {
|
|
|
+ * authorize("/public", permitAll)
|
|
|
+ * authorize(anyRequest, authenticated)
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -221,16 +221,16 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * authorizeHttpRequests {
|
|
|
- * authorize("/public", permitAll)
|
|
|
- * authorize(anyRequest, authenticated)
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * authorizeHttpRequests {
|
|
|
+ * authorize("/public", permitAll)
|
|
|
+ * authorize(anyRequest, authenticated)
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -253,15 +253,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * httpBasic {
|
|
|
- * realmName = "Custom Realm"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * httpBasic {
|
|
|
+ * realmName = "Custom Realm"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -283,15 +283,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * passwordManagement {
|
|
|
- * changePasswordPage = "/custom-change-password-page"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * passwordManagement {
|
|
|
+ * changePasswordPage = "/custom-change-password-page"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -314,17 +314,17 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * headers {
|
|
|
- * referrerPolicy {
|
|
|
- * policy = ReferrerPolicy.SAME_ORIGIN
|
|
|
- * }
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * headers {
|
|
|
+ * referrerPolicy {
|
|
|
+ * policy = ReferrerPolicy.SAME_ORIGIN
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -346,15 +346,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * cors {
|
|
|
- * disable()
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * cors {
|
|
|
+ * disable()
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -376,18 +376,18 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * sessionManagement {
|
|
|
- * invalidSessionUrl = "/invalid-session"
|
|
|
- * sessionConcurrency {
|
|
|
- * maximumSessions = 1
|
|
|
- * }
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * sessionManagement {
|
|
|
+ * invalidSessionUrl = "/invalid-session"
|
|
|
+ * sessionConcurrency {
|
|
|
+ * maximumSessions = 1
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -409,15 +409,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * portMapper {
|
|
|
- * map(80, 443)
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * portMapper {
|
|
|
+ * map(80, 443)
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -439,16 +439,16 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * requiresChannel {
|
|
|
- * secure("/public", requiresInsecure)
|
|
|
- * secure(anyRequest, requiresSecure)
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * requiresChannel {
|
|
|
+ * secure("/public", requiresInsecure)
|
|
|
+ * secure(anyRequest, requiresSecure)
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -470,13 +470,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * x509 { }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * x509 { }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -499,13 +499,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * requestCache { }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * requestCache { }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -527,15 +527,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * exceptionHandling {
|
|
|
- * accessDeniedPage = "/access-denied"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * exceptionHandling {
|
|
|
+ * accessDeniedPage = "/access-denied"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -557,13 +557,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * csrf { }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * csrf { }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -584,15 +584,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * logout {
|
|
|
- * logoutUrl = "/log-out"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * logout {
|
|
|
+ * logoutUrl = "/log-out"
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -616,15 +616,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * saml2Login {
|
|
|
- * relyingPartyRegistration = getSaml2RelyingPartyRegistration()
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * saml2Login {
|
|
|
+ * relyingPartyRegistration = getSaml2RelyingPartyRegistration()
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -646,15 +646,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * anonymous {
|
|
|
- * authorities = listOf(SimpleGrantedAuthority("ROLE_ANON"))
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * anonymous {
|
|
|
+ * authorities = listOf(SimpleGrantedAuthority("ROLE_ANON"))
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -678,15 +678,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * oauth2Login {
|
|
|
- * clientRegistrationRepository = getClientRegistrationRepository()
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * oauth2Login {
|
|
|
+ * clientRegistrationRepository = getClientRegistrationRepository()
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -708,13 +708,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * oauth2Client { }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * oauth2Client { }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -736,15 +736,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * oauth2ResourceServer {
|
|
|
- * jwt { }
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * oauth2ResourceServer {
|
|
|
+ * jwt { }
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -766,15 +766,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * rememberMe {
|
|
|
- * tokenValiditySeconds = 604800
|
|
|
- * }
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * rememberMe {
|
|
|
+ * tokenValiditySeconds = 604800
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -795,13 +795,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * addFilterAt(CustomFilter(), UsernamePasswordAuthenticationFilter::class.java)
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * addFilterAt(CustomFilter(), UsernamePasswordAuthenticationFilter::class.java)
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -852,13 +852,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * addFilterAfter(CustomFilter(), UsernamePasswordAuthenticationFilter::class.java)
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * addFilterAfter(CustomFilter(), UsernamePasswordAuthenticationFilter::class.java)
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -909,13 +909,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * addFilterBefore(CustomFilter(), UsernamePasswordAuthenticationFilter::class.java)
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * addFilterBefore(CustomFilter(), UsernamePasswordAuthenticationFilter::class.java)
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -938,13 +938,13 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
- * http {
|
|
|
- * addFilterBefore<UsernamePasswordAuthenticationFilter>(CustomFilter())
|
|
|
- * }
|
|
|
- * return http.build()
|
|
|
- * }
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * http {
|
|
|
+ * addFilterBefore<UsernamePasswordAuthenticationFilter>(CustomFilter())
|
|
|
+ * }
|
|
|
+ * return http.build()
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
*
|
|
@@ -974,15 +974,15 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
|
|
|
* @EnableWebSecurity
|
|
|
* class SecurityConfig {
|
|
|
*
|
|
|
- * @Bean
|
|
|
- * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
+ * @Bean
|
|
|
+ * fun securityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
|
|
* http {
|
|
|
* securityContext {
|
|
|
* securityContextRepository = SECURITY_CONTEXT_REPOSITORY
|
|
|
* }
|
|
|
* }
|
|
|
* return http.build()
|
|
|
- * }
|
|
|
+ * }
|
|
|
* }
|
|
|
* ```
|
|
|
* @author Norbert Nowak
|