Class UrlAuthorizationConfigurer<H extends HttpSecurityBuilder<H>>
- java.lang.Object
-
- org.springframework.security.config.annotation.SecurityConfigurerAdapter<org.springframework.security.web.DefaultSecurityFilterChain,B>
-
- org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer<C,H>
-
- org.springframework.security.config.annotation.web.configurers.AbstractInterceptUrlConfigurer<UrlAuthorizationConfigurer<H>,H>
-
- org.springframework.security.config.annotation.web.configurers.UrlAuthorizationConfigurer<H>
-
- Type Parameters:
H- the type ofHttpSecurityBuilderthat is being configured
- All Implemented Interfaces:
SecurityConfigurer<org.springframework.security.web.DefaultSecurityFilterChain,H>
public final class UrlAuthorizationConfigurer<H extends HttpSecurityBuilder<H>> extends AbstractInterceptUrlConfigurer<UrlAuthorizationConfigurer<H>,H>
Adds URL based authorization usingDefaultFilterInvocationSecurityMetadataSource. At least oneRequestMappingneeds to be mapped toConfigAttribute's for thisSecurityContextConfigurerto have meaning.Security Filters
Usage includes applying the
UrlAuthorizationConfigurerand then modifying the StandardInterceptUrlRegistry. For example:@Bean public SecurityFilterChain filterChain(HttpSecurity http, ApplicationContext context) throws Exception { http.apply(new UrlAuthorizationConfigurer<HttpSecurity>(context)).getRegistry() .requestMatchers("/users**", "/sessions/**").hasRole("USER") .requestMatchers("/signup").hasRole("ANONYMOUS").anyRequest().hasRole("USER"); }The following Filters are populated-
FilterSecurityInterceptor
Shared Objects Created
The following shared objects are populated to allow otherSecurityConfigurer's to customize:-
FilterSecurityInterceptor
Shared Objects Used
The following shared objects are used:- AuthenticationManager
- Since:
- 3.2
- See Also:
ExpressionUrlAuthorizationConfigurer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classUrlAuthorizationConfigurer.AuthorizedUrlMaps the specifiedRequestMatcherinstances toConfigAttributeinstances.classUrlAuthorizationConfigurer.MvcMatchersAuthorizedUrlAnUrlAuthorizationConfigurer.AuthorizedUrlthat allows optionally configuring theMvcRequestMatcher.setMethod(HttpMethod)classUrlAuthorizationConfigurer.StandardInterceptUrlRegistry-
Nested classes/interfaces inherited from class org.springframework.security.config.annotation.web.configurers.AbstractInterceptUrlConfigurer
AbstractInterceptUrlConfigurer.AbstractInterceptUrlRegistry<R extends AbstractInterceptUrlConfigurer.AbstractInterceptUrlRegistry<R,T>,T>
-
-
Constructor Summary
Constructors Constructor Description UrlAuthorizationConfigurer(org.springframework.context.ApplicationContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UrlAuthorizationConfigurer.StandardInterceptUrlRegistrygetRegistry()The StandardInterceptUrlRegistry is what users will interact with after applying theUrlAuthorizationConfigurer.UrlAuthorizationConfigurer<H>withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)Adds anObjectPostProcessorfor this class.-
Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractInterceptUrlConfigurer
configure
-
Methods inherited from class org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer
disable
-
Methods inherited from class org.springframework.security.config.annotation.SecurityConfigurerAdapter
addObjectPostProcessor, and, getBuilder, init, postProcess, setBuilder
-
-
-
-
Method Detail
-
getRegistry
public UrlAuthorizationConfigurer.StandardInterceptUrlRegistry getRegistry()
The StandardInterceptUrlRegistry is what users will interact with after applying theUrlAuthorizationConfigurer.- Returns:
- the
ExpressionUrlAuthorizationConfigurerfor further customizations
-
withObjectPostProcessor
public UrlAuthorizationConfigurer<H> withObjectPostProcessor(ObjectPostProcessor<?> objectPostProcessor)
Adds anObjectPostProcessorfor this class.- Overrides:
withObjectPostProcessorin classAbstractHttpConfigurer<UrlAuthorizationConfigurer<H extends HttpSecurityBuilder<H>>,H extends HttpSecurityBuilder<H>>- Parameters:
objectPostProcessor-- Returns:
- the
UrlAuthorizationConfigurerfor further customizations
-
-