diff --git a/docs/modules/ROOT/pages/servlet/exploits/csrf.adoc b/docs/modules/ROOT/pages/servlet/exploits/csrf.adoc index 60622f2e4b..3cec92f5a5 100644 --- a/docs/modules/ROOT/pages/servlet/exploits/csrf.adoc +++ b/docs/modules/ROOT/pages/servlet/exploits/csrf.adoc @@ -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 @@ -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 @@ -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