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
-
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.RequestMatcherConfigurer
chainRequestMatchers
(List<RequestMatcher> requestMatchers) Subclasses should implement this method for returning the object that is chained to the creation of theRequestMatcher
instances.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:AbstractRequestMatcherRegistry
Subclasses should implement this method for returning the object that is chained to the creation of theRequestMatcher
instances.- Specified by:
chainRequestMatchers
in classAbstractRequestMatcherRegistry<HttpSecurity.RequestMatcherConfigurer>
- Parameters:
requestMatchers
- theRequestMatcher
instances 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 theHttpSecurity
for further customizations- Returns:
- the
HttpSecurity
for further customizations
-