Skip to content

Commit

Permalink
Move imports to code section
Browse files Browse the repository at this point in the history
Issue gh-13089
  • Loading branch information
sjohnr committed May 15, 2023
1 parent ab519a9 commit f54c344
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions docs/modules/ROOT/pages/servlet/exploits/csrf.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,11 @@ You can use Spring Security's xref:servlet/test/mockmvc/setup.adoc[testing suppo
.Java
[source,java,role="primary"]
----
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*;
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = SecurityConfig.class)
@WebAppConfiguration
Expand Down Expand Up @@ -1192,6 +1197,11 @@ public class CsrfTests {
.Kotlin
[source,kotlin,role="secondary"]
----
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*
import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.*
@ExtendWith(SpringExtension::class)
@ContextConfiguration(classes = [SecurityConfig::class])
@WebAppConfiguration
Expand Down Expand Up @@ -1228,31 +1238,6 @@ class CsrfTests {
----
====

[TIP]
====
The above example uses the following static imports:
=====
.Java
[source,java,role="primary"]
----
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*;
import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
----

.Kotlin
[source,kotlin,role="secondary"]
----
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*
import org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.*
----
=====
====

[[disable-csrf]]
== Disable CSRF Protection

Expand Down

0 comments on commit f54c344

Please sign in to comment.