Class UrlAuthorizationConfigurer.AuthorizedUrl
- java.lang.Object
-
- org.springframework.security.config.annotation.web.configurers.UrlAuthorizationConfigurer.AuthorizedUrl
-
- Direct Known Subclasses:
UrlAuthorizationConfigurer.MvcMatchersAuthorizedUrl
- Enclosing class:
- UrlAuthorizationConfigurer<H extends HttpSecurityBuilder<H>>
public class UrlAuthorizationConfigurer.AuthorizedUrl extends java.lang.Object
Maps the specifiedRequestMatcher
instances toConfigAttribute
instances.- Since:
- 3.2
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UrlAuthorizationConfigurer.StandardInterceptUrlRegistry
access(java.lang.String... attributes)
Specifies that the user must have the specifiedConfigAttribute
'sUrlAuthorizationConfigurer.StandardInterceptUrlRegistry
anonymous()
Specifies that an anonymous user is allowed accessprotected java.util.List<? extends RequestMatcher>
getMatchers()
UrlAuthorizationConfigurer.StandardInterceptUrlRegistry
hasAnyAuthority(java.lang.String... authorities)
Specifies that a user requires one of many authoritiesUrlAuthorizationConfigurer.StandardInterceptUrlRegistry
hasAnyRole(java.lang.String... roles)
Specifies that a user requires one of many roles.UrlAuthorizationConfigurer.StandardInterceptUrlRegistry
hasAuthority(java.lang.String authority)
Specifies a user requires an authority.UrlAuthorizationConfigurer.StandardInterceptUrlRegistry
hasRole(java.lang.String role)
Specifies a user requires a role.
-
-
-
Method Detail
-
hasRole
public UrlAuthorizationConfigurer.StandardInterceptUrlRegistry hasRole(java.lang.String role)
Specifies a user requires a role.- Parameters:
role
- the role that should be required which is prepended with ROLE_ automatically (i.e. USER, ADMIN, etc). It should not start with ROLE_ theUrlAuthorizationConfigurer
for further customization
-
hasAnyRole
public UrlAuthorizationConfigurer.StandardInterceptUrlRegistry hasAnyRole(java.lang.String... roles)
Specifies that a user requires one of many roles.- Parameters:
roles
- the roles that the user should have at least one of (i.e. ADMIN, USER, etc). Each role should not start with ROLE_ since it is automatically prepended already.- Returns:
- the
UrlAuthorizationConfigurer
for further customization
-
hasAuthority
public UrlAuthorizationConfigurer.StandardInterceptUrlRegistry hasAuthority(java.lang.String authority)
Specifies a user requires an authority.- Parameters:
authority
- the authority that should be required- Returns:
- the
UrlAuthorizationConfigurer
for further customization
-
hasAnyAuthority
public UrlAuthorizationConfigurer.StandardInterceptUrlRegistry hasAnyAuthority(java.lang.String... authorities)
Specifies that a user requires one of many authorities- Parameters:
authorities
- the authorities that the user should have at least one of (i.e. ROLE_USER, ROLE_ADMIN, etc).- Returns:
- the
UrlAuthorizationConfigurer
for further customization
-
anonymous
public UrlAuthorizationConfigurer.StandardInterceptUrlRegistry anonymous()
Specifies that an anonymous user is allowed access- Returns:
- the
UrlAuthorizationConfigurer
for further customization
-
access
public UrlAuthorizationConfigurer.StandardInterceptUrlRegistry access(java.lang.String... attributes)
Specifies that the user must have the specifiedConfigAttribute
's- Parameters:
attributes
- theConfigAttribute
's that restrict access to a URL- Returns:
- the
UrlAuthorizationConfigurer
for further customization
-
getMatchers
protected java.util.List<? extends RequestMatcher> getMatchers()
-
-