Class HttpSecurity.RequestMatcherConfigurer
java.lang.Object
org.springframework.security.config.annotation.web.AbstractRequestMatcherRegistry<HttpSecurity.RequestMatcherConfigurer>
org.springframework.security.config.annotation.web.builders.HttpSecurity.RequestMatcherConfigurer
- Enclosing class:
- HttpSecurity
public class HttpSecurity.RequestMatcherConfigurer
extends AbstractRequestMatcherRegistry<HttpSecurity.RequestMatcherConfigurer>
Allows mapping HTTP requests that this
HttpSecurity will be used for- Since:
- 3.2
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionand()Deprecated, for removal: This API element is subject to removal in a future version.Use the lambda based configuration instead.protected HttpSecurity.RequestMatcherConfigurerchainRequestMatchers(List<RequestMatcher> requestMatchers) Subclasses should implement this method for returning the object that is chained to the creation of theRequestMatcherinstances.Methods inherited from class org.springframework.security.config.annotation.web.AbstractRequestMatcherRegistry
anyRequest, createMvcMatchers, dispatcherTypeMatchers, dispatcherTypeMatchers, getApplicationContext, requestMatchers, requestMatchers, requestMatchers, requestMatchers, setApplicationContext
-
Field Details
-
matchers
-
-
Method Details
-
chainRequestMatchers
protected HttpSecurity.RequestMatcherConfigurer chainRequestMatchers(List<RequestMatcher> requestMatchers) Description copied from class:AbstractRequestMatcherRegistrySubclasses should implement this method for returning the object that is chained to the creation of theRequestMatcherinstances.- Specified by:
chainRequestMatchersin classAbstractRequestMatcherRegistry<HttpSecurity.RequestMatcherConfigurer>- Parameters:
requestMatchers- theRequestMatcherinstances that were created- Returns:
- the chained Object for the subclass which allows association of something
else to the
RequestMatcher
-
and
Deprecated, for removal: This API element is subject to removal in a future version.Use the lambda based configuration instead. For example:@Configuration @EnableWebSecurity public class SecurityConfig { @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http .securityMatchers((matchers) -> matchers .requestMatchers("/api/**") ) .authorizeHttpRequests((authorize) -> authorize .anyRequest().hasRole("USER") ) .httpBasic(Customizer.withDefaults()); return http.build(); } }Return theHttpSecurityfor further customizations- Returns:
- the
HttpSecurityfor further customizations
-