BAEL-3338: A Guide to AuthenticationManagerResolver in Spring Security

-Fix issues according to review
This commit is contained in:
maryarm 2019-12-14 19:26:34 +03:30
parent 41a8ea19d3
commit 5cf5456e35
2 changed files with 7 additions and 5 deletions

View File

@ -44,8 +44,9 @@ public class CustomWebSecurityConfig {
.getPath() .getPath()
.subPath(0) .subPath(0)
.value() .value()
.startsWith("/employee")) .startsWith("/employee")) {
return Mono.just(employeesAuthenticationManager()); return Mono.just(employeesAuthenticationManager());
}
return Mono.just(customersAuthenticationManager()); return Mono.just(customersAuthenticationManager());
}; };
} }

View File

@ -27,8 +27,9 @@ public class CustomWebSecurityConfigurer extends WebSecurityConfigurerAdapter {
return request -> { return request -> {
if (request if (request
.getPathInfo() .getPathInfo()
.startsWith("/employee")) .startsWith("/employee")) {
return employeesAuthenticationManager(); return employeesAuthenticationManager();
}
return customersAuthenticationManager(); return customersAuthenticationManager();
}; };
} }
@ -63,10 +64,10 @@ public class CustomWebSecurityConfigurer extends WebSecurityConfigurerAdapter {
} }
private AuthenticationFilter authenticationFilter() { private AuthenticationFilter authenticationFilter() {
AuthenticationFilter ret = new AuthenticationFilter( AuthenticationFilter filter = new AuthenticationFilter(
resolver(), authenticationConverter()); resolver(), authenticationConverter());
ret.setSuccessHandler((request, response, auth) -> {}); filter.setSuccessHandler((request, response, auth) -> {});
return ret; return filter;
} }
private AuthenticationManager employeesAuthenticationManager() { private AuthenticationManager employeesAuthenticationManager() {