How to get ServerWebExchange object in SecurityWebFilterChain bean

515 Views Asked by At

Hello Spring WebFlux community, I have implemented x509 based authentication in spring webflux security bean using below code:

@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {

ReactiveAuthenticationManager authMan = auth0 -> {
    ..//lambda logic of setAuthenticated true, HERE I NEED TO ACCESS CURRENT REQUEST HEADERS VALUE BEFORE SETTING IT TO TRUE
};

   http.x509(x509 -> x509
                .principalExtractor(myx509PrincipalExtractor())
                .authenticationManager(authMan ))
        .authorizeExchange(exchanges ->
            exchanges.anyExchange().authenticated());
   return http.build();
}

Now, please observe the comment part inside auth0 lambda, there I need to access header values of current request. How can I get that ?

0

There are 0 best solutions below