mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-05-31 01:02:14 +00:00
Correct access(String) reference
Closes gh-11280
This commit is contained in:
parent
8690accd57
commit
292585080a
@ -69,7 +69,11 @@ SecurityFilterChain web(HttpSecurity http) throws Exception {
|
|||||||
.authorizeHttpRequests(authorize -> authorize // <1>
|
.authorizeHttpRequests(authorize -> authorize // <1>
|
||||||
.mvcMatchers("/resources/**", "/signup", "/about").permitAll() // <2>
|
.mvcMatchers("/resources/**", "/signup", "/about").permitAll() // <2>
|
||||||
.mvcMatchers("/admin/**").hasRole("ADMIN") // <3>
|
.mvcMatchers("/admin/**").hasRole("ADMIN") // <3>
|
||||||
.mvcMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')") // <4>
|
.mvcMatchers("/db/**").access((authentication, request) ->
|
||||||
|
Optional.of(hasRole("ADMIN").check(authentication, request))
|
||||||
|
.filter((decision) -> !decision.isGranted())
|
||||||
|
.orElseGet(() -> hasRole("DBA").check(authentication, request));
|
||||||
|
) // <4>
|
||||||
.anyRequest().denyAll() // <5>
|
.anyRequest().denyAll() // <5>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user