-
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
Provide a way to specify HttpAuthenticationMechanism per JAX-RS resource #34664
Comments
/cc @sberyozkin |
Hi @Eng-Fouad We don't have such an option supported right now |
/cc @pedroigor (bearer-token) |
Is this going to be really useful in real life? @FroMage @michalvavrik @sberyozkin WDYT? |
Resource auth mechanism will still be mechanism for set of paths, so basically, it is about being able to use annotation instead of config properties? Problem is that security path matching is different than Personally I'd use HTTP security policy or https://quarkus.io/guides/security-customization#httpauthenticationmechanism-customization (and have delegates based on path) as it provides me with same options. |
I have an app that has 3 Also, I use path params and I find it difficult to configure auth mechanism based on paths:
|
Ok, that makes sense, thank you for sharing it. Possibly it is not a very common case, though? I agree we should improve path matching and unless I'm mistaken, I have seen opened issue for that in past (don't have time to look it up right now). As annotation portion of this issue, it would be nice if users who are in similar situation wrote here. |
Path matching portion is related to #14047 |
@geoand I thought about that and ability to match auth mechanism with endpoint have value considering Quarkus Security patch matching abilities (see #14047) are not yet where they can be of interest. I can imagine someone want to mark endpoint. And here #34833, I have opened myself way to implement this :-) We can even take it further! (Note: this feature can only work with disabled proactive auth):
@sberyozkin I think enhancing patch matching (#14047 ) or this (match endpoint -> HTTP security policy -> auth mechanism) makes sense. I'm not going to do anything in this direction till there is at least elemental agreement on what it should be as it might be a lot of work. WDYT? Truth is that I don't know how usual case it is to have more than one auth mechanism. |
Interestingly enough, just today I read issue that uses multiple auth mechanisms #34897. |
While I appreciate some applications can be very complex, a requirement to support multiple authentication requirements for example in a single class or in the overlapping URI spaces etc might indicate some refactoring is warranted. I'd propose to keep is as simple as we can to start with, support annotations only to start with. |
It is interesting, sure, worth making it more advanced; I'd only propose to iterate in this regard, start with the annotations, then do something interesting with policies 👍 |
This can be done and also I like it! I presume @Eng-Fouad won't object? It's very close to your origin proposal.
I'm afraid under the hood it might be some internal policy anyway, because it is just the easiest way to do it. Also, having |
It seems useful, I've had the case where I wanted basic auth for one endpoint, and OIDC for another. It would have been nicer to do with annotations on endpoints than with config path matching. However, correct me if I'm wrong, but I think I don't see how I mean, I think Authentication (that's where we select which auth mechanism is in place) happens before RR, which again happens before we do Authorization (checking |
I think it works same for all auth mechanisms - with proactive auth it can't ever work as this handler must run before RR, with lazy auth for RBAC annotations it can work for now we have way to run code for annotated endpoint before authorization is done. As for configuration based path matching HTTP policy, we would run
With proactive auth yes, but with lazy auth I think it happens when Theoretically there could be a risk that if some extension runs before RESTEasy Reactive starts processing as Vert.x route handler with higher priority and requests identity, the wrong one would be resolved. But it is not unlike OIDC multitenancy annotation based approach Anyway, I can only get to this by the end of next month, so only then I'll know whether above-mentioned approach is viable. If you have some suggestion, please bring it on. |
Description
Currently,
HttpAuthenticationMechanism
can be specified based on paths:In addition to that, one can specify it per JAX-RS resource. Something like:
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: