Skip to content

Commit 2925850

Browse files
committed
Correct access(String) reference
Closes gh-11280
1 parent 8690acc commit 2925850

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc

+5-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ SecurityFilterChain web(HttpSecurity http) throws Exception {
6969
.authorizeHttpRequests(authorize -> authorize // <1>
7070
.mvcMatchers("/resources/**", "/signup", "/about").permitAll() // <2>
7171
.mvcMatchers("/admin/**").hasRole("ADMIN") // <3>
72-
.mvcMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')") // <4>
72+
.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>
7377
.anyRequest().denyAll() // <5>
7478
);
7579

0 commit comments

Comments
 (0)