-
Notifications
You must be signed in to change notification settings - Fork 6k
Looking for guidance on implementing security in WebFlux/reactive environment #5328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I also find it hard to get request detail(like remote IP, header, cookie etc) in the |
@edeandrea You are correct that this is the correct approach. WebFlux is still fairly new so there are certainly pieces that need built out. Can you elaborate on the "stuff" you need? I'd love to see links to some new tickets on additional things you need |
@zjengjie Can you turn your concern into a specific ticket? |
Thanks @rwinch. By "stuff" I'm talking more about the structure/hierarchy of the existing servlet-based filters: Do you see foresee Spring Security building base In my organization I am going to build some of this stuff that I need and if I have insight into what the longer-term plan is for the reactive-side within Spring Security I can certainly align to it and potentially even contribute it back, as I have been doing with other building blocks. |
@edeandrea Thanks for the reply. The reactive (WebFlux) support in Spring Security is quite similar to the imperative (servlet) support, but we have tried to make some changes where it made sense. One of these is to favor composition to inheritance. This means we do not have plans for a hiearchy of Filter's but instead will try to provide the
That sounds great! We'd love contributions. Again, please don't hesitate to reach out if you need to. |
Thanks @rwinch for the guidance. FWIW - One thing I would have loved to have seen was a dedicated interface for an authentication converter and have all the implementations extend/implement that, rather than a generic @FunctionalInterface
public interface AuthenticationConverter extends Function<ServerWebExchange, Mono<Authentication>> {
} Mainly the reason is as a consumer of the framework its really easy in the IDE to open the hierarchy of an interface to see which implementations are available within the framework. The Javadocs would also reflect this hierarchy. Doing that for a plain Java |
@edeandrea I have actually considered that myself. Would you mind creating a ticket for that? |
I certainly can. I would also think that changing public void setAuthenticationConverter(Function<ServerWebExchange, Mono<Authentication>> authenticationConverter) to public void setAuthenticationConverter(AuthenticationConverter authenticationConverter) as well as retro-fitting |
It would. However, we can either leave the method as is (it extends Function), add an overloaded method (deprecating the old one), or even add a different setter method like |
Maybe leaving the old one as-is & deprecating it, then adding an overloaded one is better, as well as retrofitting I've added #5338 for this. |
I'm looking for a little guidance on how to implement some things within a WebFlux/reactive environment.
More specifically I'm looking for what the best approach is for building reactive equivalents of the
RequestHeaderAuthenticationFilter
and theAbstractAuthenticationProcessingFilter
.In our organization we offer our application developers (Spring Boot RESTful services) the way to configure their applications to be either protected by siteminder (
RequestHeaderAuthenticationFilter
) or by JWT tokens passed as Authorization Bearer headers (custom implementation ofAbstractAuthenticationProcessingFilter
).When looking at the reactive filters currently available I see the
AuthenticationWebFilter
which has aServerHttpBasicAuthenticationConverter
as theauthenticationConverter
as well asHttpBasicServerAuthenticationEntryPoint
set within theServerAuthenticationFailureHandler
.Am I safe to assume that the correct thing to do would be to build custom
authenticationConverter
s for my 2 use cases? I've already added #5325 for allowing anHttpStatusServerEntryPoint
, which is what I would set within theServerAuthenticationFailureHandler
.Or is it a better approach to build a custom
WebFilter
?It just seems there's lots of "stuff" in
RequestHeaderAuthenticationFilter
(and it'sAbstractPreAuthenticatedProcessingFilter
parent class) as well as inAbstractAuthenticationProcessingFilter
that I'd have to replicate. Plus given #4961 the whole event notification things don't work.The text was updated successfully, but these errors were encountered: