Class SecurityMockMvcRequestPostProcessors.CsrfRequestPostProcessor
java.lang.Object
org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.CsrfRequestPostProcessor
- All Implemented Interfaces:
org.springframework.test.web.servlet.request.RequestPostProcessor
- Enclosing class:
- SecurityMockMvcRequestPostProcessors
public static final class SecurityMockMvcRequestPostProcessors.CsrfRequestPostProcessor
extends Object
implements org.springframework.test.web.servlet.request.RequestPostProcessor
Populates a valid
CsrfToken into the request.- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionasHeader()Instead of using theCsrfTokenas a request parameter (default) will populate theCsrfTokenas a header.org.springframework.mock.web.MockHttpServletRequestpostProcessRequest(org.springframework.mock.web.MockHttpServletRequest request) Populates an invalid token value on the request.
-
Method Details
-
postProcessRequest
public org.springframework.mock.web.MockHttpServletRequest postProcessRequest(org.springframework.mock.web.MockHttpServletRequest request) - Specified by:
postProcessRequestin interfaceorg.springframework.test.web.servlet.request.RequestPostProcessor
-
asHeader
Instead of using theCsrfTokenas a request parameter (default) will populate theCsrfTokenas a header.- Returns:
- the
SecurityMockMvcRequestPostProcessors.CsrfRequestPostProcessorfor additional customizations
-
useInvalidToken
Populates an invalid token value on the request.- Returns:
- the
SecurityMockMvcRequestPostProcessors.CsrfRequestPostProcessorfor additional customizations
-