-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
WebSockets Next: Support for secure upgrade with security annotations only #40622
Comments
I think your example should be preferred way to do authorization, considering the |
Securing classes doesn't make sense for CDI beans (conflict between annotated methods vs inherited class level annotations + you do not invoke bean, you invoke method), it would be WebSocket NEXT specific. I think we should simply secure I think it makes sense that when class or If that is acceptable, I'll implement it. |
@mkouba ^^ |
Generated endpoint inherits |
My concern with
Well, that does not really matter IMO. The generated endpoint class merely delegates to the endpoint bean instance. |
makes sense @mkouba , I'll make it WS Next specific. Thanks for the feedback. |
also my understanding is that the description of this issue is not exactly what should be implemented from @mkouba feedback. if I get it right, the upgrade should be secured only when endpoint is annotated on the class level. and |
Yes, I believe that this would be the most understandable for users. In any case, it has to be properly documented because it's not exactly obvious. In fact, we should probably remove the security annotations declared on the endpoint class through a transformer so that the interceptors are not applied to the methods later on... CC @cescoffier |
+1; normally we keep the interceptors as a fallback and it saved us in past when the detection of annotations wasn't perfect, but here it must work differently and there are no conflicts between methods / classes annotations. |
@mkouba and I discussed about this last week. @mkouba can you write what we discussed (@authenticated and @ROLE Allowed on the class, the "upgrade" SPI...) |
Yes, sure.
|
yeah, I already have it implemented (tests including). I just need to write docs (maybe tomorrow), but there is no hurry as Sergey is on PTO this week and we will need him to review. It required some changes in the Security extension. |
Another thing we discussed is the ability for the user (application developer) to contribute before the upgrade (sub-protocol negotiation, custom security...). Note that these 'contributions' can change the upgrade response (like the selected sub-protocol), or reject the connection. Because we can have multiple 'contributions', the plan was to use CDI bean order to build the chain. Security would be a part of this chain ;around the middle so the user can contribute before and after). This contribution SPI is not yet define. |
Well, the
Yes, we should probably start with a list of "contributions" ;-) |
@cescoffier @mkouba I am not sure what additional SPI is required from your comments, but here #40957 is PR based on |
I put it |
No problem. I think that
|
Description
It is a follow up to #40534.
With #40534 users will be able to secure WS callbacks with security annotations like
@Authenticated
or@RolesAllowed
but an actual HTTP upgrade will only be secured if either HTTP authentication or RBAC policy securing the HTTP upgrade path is also added - this is a good initial solution but it should not be required for a secure upgrade, having eitheror
should be enough for users be able to work with the annotations only
Implementation ideas
Some initial thoughts from Martin:
It would be nice to be able to redirect a user to a configure HTTP page if the security control fails at the handshake time
The text was updated successfully, but these errors were encountered: