Class SecurityMockMvcConfigurers
- java.lang.Object
-
- org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers
-
public final class SecurityMockMvcConfigurers extends java.lang.ObjectProvides Security relatedMockMvcConfigurerimplementations.- Since:
- 4.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.springframework.test.web.servlet.setup.MockMvcConfigurerspringSecurity()Configures the MockMvcBuilder for use with Spring Security.static org.springframework.test.web.servlet.setup.MockMvcConfigurerspringSecurity(javax.servlet.Filter springSecurityFilterChain)Configures the MockMvcBuilder for use with Spring Security.
-
-
-
Method Detail
-
springSecurity
public static org.springframework.test.web.servlet.setup.MockMvcConfigurer springSecurity()
Configures the MockMvcBuilder for use with Spring Security. Specifically the configurer adds the Spring Bean named "springSecurityFilterChain" as a Filter. It will also ensure that the TestSecurityContextHolder is leveraged for each request by applyingSecurityMockMvcRequestPostProcessors.testSecurityContext().- Returns:
- the
MockMvcConfigurerto use
-
springSecurity
public static org.springframework.test.web.servlet.setup.MockMvcConfigurer springSecurity(javax.servlet.Filter springSecurityFilterChain)
Configures the MockMvcBuilder for use with Spring Security. Specifically the configurer adds the provided Filter. It will also ensure that the TestSecurityContextHolder is leveraged for each request by applyingSecurityMockMvcRequestPostProcessors.testSecurityContext().- Parameters:
springSecurityFilterChain- the Filter to be added- Returns:
- the
MockMvcConfigurerto use
-
-