Fix servlet/architecture.adoc disable Sample
- Switch `include-java` (does not exist) to `include-code` - Update kotlin to have the `disable` tag - Update to suppress deprecation use for User builder (allowed for samples) Signed-off-by: Robert Winch <362503+rwinch@users.noreply.github.com>
This commit is contained in:
+2
-2
@@ -142,16 +142,16 @@ public class CustomizingFilterTests {
|
||||
@EnableWebSecurity
|
||||
static class SecurityConfigDisable {
|
||||
|
||||
// tag::disable[]
|
||||
@Bean
|
||||
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
// tag::disable[]
|
||||
.httpBasic((basic) -> basic.disable());
|
||||
// end::disable[]
|
||||
// ...
|
||||
|
||||
return http.build();
|
||||
}
|
||||
// end::disable[]
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -84,6 +84,7 @@ class CustomFilterTests {
|
||||
open class UserDetailsConfig {
|
||||
@Bean
|
||||
open fun userDetailsService(): UserDetailsService {
|
||||
@Suppress("DEPRECATION")
|
||||
val user: UserDetails = User.withDefaultPasswordEncoder()
|
||||
.username("user")
|
||||
.password("password")
|
||||
|
||||
+17
-2
@@ -26,7 +26,6 @@ import org.junit.jupiter.api.extension.ExtendWith
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.http.HttpHeaders
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
|
||||
import org.springframework.security.config.annotation.web.invoke
|
||||
@@ -36,7 +35,6 @@ import org.springframework.security.web.FilterChainProxy
|
||||
import org.springframework.security.web.SecurityFilterChain
|
||||
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter
|
||||
import org.springframework.test.web.servlet.MockMvc
|
||||
import org.springframework.test.web.servlet.get
|
||||
|
||||
/**
|
||||
* Tests for customizing security filters.
|
||||
@@ -120,6 +118,23 @@ class CustomizingFilterTests {
|
||||
|
||||
}
|
||||
|
||||
@Configuration @EnableWebSecurity
|
||||
open class SecurityConfigDisable {
|
||||
|
||||
// tag::disable[]
|
||||
@Bean
|
||||
open fun filterChain(http: HttpSecurity): SecurityFilterChain {
|
||||
http {
|
||||
httpBasic {
|
||||
disable()
|
||||
}
|
||||
// ...
|
||||
}
|
||||
return http.build()
|
||||
}
|
||||
// end::disable[]
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
open class SecurityConfigIncorrect {
|
||||
|
||||
Reference in New Issue
Block a user