From 292585080adf2c007194592bca0e912dd5d06d4b Mon Sep 17 00:00:00 2001 From: Josh Cummings Date: Fri, 27 May 2022 14:51:45 -0600 Subject: [PATCH] Correct access(String) reference Closes gh-11280 --- .../servlet/authorization/authorize-http-requests.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc b/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc index d318f4d7be..5a52c4f23f 100644 --- a/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc +++ b/docs/modules/ROOT/pages/servlet/authorization/authorize-http-requests.adoc @@ -69,7 +69,11 @@ SecurityFilterChain web(HttpSecurity http) throws Exception { .authorizeHttpRequests(authorize -> authorize // <1> .mvcMatchers("/resources/**", "/signup", "/about").permitAll() // <2> .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> );