Skip to content

Commit 4c9ee66

Browse files
committed
Fix servlet/architecture.adoc disable Sample
Previously `include-java` was used (does not exist) instead of `include-code`. Additionally, the kotlin sample did not have the `disable` tag. Signed-off-by: Robert Winch <362503+rwinch@users.noreply.github.com>
1 parent 62d1bc8 commit 4c9ee66

3 files changed

Lines changed: 20 additions & 5 deletions

File tree

docs/modules/ROOT/pages/servlet/architecture.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ In this case, remove the call to `httpBasic` since you are constructing `BasicAu
301301
====
302302
In the event that you are unable to reconfigure `HttpSecurity` to not add a certain filter, you can typically disable the Spring Security filter by calling its DSL's `disable` method like so:
303303
304-
include-java::./CustomizingFilterTests[tag=disable,indent=0]
304+
include-code::./CustomizingFilterTests[tag=disable,indent=0]
305305
====
306306

307307
[[servlet-exceptiontranslationfilter]]

docs/src/test/java/org/springframework/security/docs/servlet/customizingfilter/CustomizingFilterTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,16 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
142142
@EnableWebSecurity
143143
static class SecurityConfigDisable {
144144

145+
// tag::disable[]
145146
@Bean
146147
SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
147148
http
148-
// tag::disable[]
149149
.httpBasic((basic) -> basic.disable());
150-
// end::disable[]
151150
// ...
152151

153152
return http.build();
154153
}
154+
// end::disable[]
155155

156156
}
157157

docs/src/test/kotlin/org/springframework/security/kt/docs/servlet/customizingfilter/CustomizingFilterTests.kt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import org.junit.jupiter.api.extension.ExtendWith
2626
import org.springframework.beans.factory.annotation.Autowired
2727
import org.springframework.context.annotation.Bean
2828
import org.springframework.context.annotation.Configuration
29-
import org.springframework.http.HttpHeaders
3029
import org.springframework.security.config.annotation.web.builders.HttpSecurity
3130
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
3231
import org.springframework.security.config.annotation.web.invoke
@@ -36,7 +35,6 @@ import org.springframework.security.web.FilterChainProxy
3635
import org.springframework.security.web.SecurityFilterChain
3736
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter
3837
import org.springframework.test.web.servlet.MockMvc
39-
import org.springframework.test.web.servlet.get
4038

4139
/**
4240
* Tests for customizing security filters.
@@ -120,6 +118,23 @@ class CustomizingFilterTests {
120118

121119
}
122120

121+
@Configuration @EnableWebSecurity
122+
open class SecurityConfigDisable {
123+
124+
// tag::disable[]
125+
@Bean
126+
open fun filterChain(http: HttpSecurity): SecurityFilterChain {
127+
http {
128+
httpBasic {
129+
disable()
130+
}
131+
// ...
132+
}
133+
return http.build()
134+
}
135+
// end::disable[]
136+
}
137+
123138
@Configuration
124139
@EnableWebSecurity
125140
open class SecurityConfigIncorrect {

0 commit comments

Comments
 (0)