We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8690acc commit 2925850Copy full SHA for 2925850
docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc
@@ -69,7 +69,11 @@ SecurityFilterChain web(HttpSecurity http) throws Exception {
69
.authorizeHttpRequests(authorize -> authorize // <1>
70
.mvcMatchers("/resources/**", "/signup", "/about").permitAll() // <2>
71
.mvcMatchers("/admin/**").hasRole("ADMIN") // <3>
72
- .mvcMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')") // <4>
+ .mvcMatchers("/db/**").access((authentication, request) ->
73
+ Optional.of(hasRole("ADMIN").check(authentication, request))
74
+ .filter((decision) -> !decision.isGranted())
75
+ .orElseGet(() -> hasRole("DBA").check(authentication, request));
76
+ ) // <4>
77
.anyRequest().denyAll() // <5>
78
);
79
0 commit comments