I'm building a reactive Spring application and I have two ways of authentication the user: x509 and JWT. I have /path1 which should authenticate using x509 and /path2 using customAuthManager which is just a JWT one.
The issue I have is that my filter chain is not respecting the pathmatchers. Code is below:
http
.authorizeExchange()
.pathMatchers("/path1").authenticated()
.and()
.x509()
.and()
.authorizeExchange()
.pathMatchers("/path2").authenticated()
.and()
.oauth2ResourceServer()
.authenticationManagerResolver(customAuthenticationManager());
Expected: /path1 requests should be auth. by x509 and /path2 by customerAuthManager.
Question: How do I divert the request to its proper authentication method based on path?