-
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
Enable authentication by default if a SecurityIdentity-providing module is enabled #5485
Comments
Agree with @sberyozkin suggestion here in "Step 2". If someone annotates a resorce with "Authenticated" but does not have "quarkus-keycloak-authorization" in the |
I like to work on it. May I? |
We already have the option in resteasy to deny access to endpoints without security annotations, which IMHO is enough. Applying a blanket 'authenticated' by default is IMHO a bit confusing, as it means @permitAll annotations would not work (as the request would be rejected before it reaches the bean). |
? |
@stuartwdouglas Hi Stuart, the case which is of interest to some users is where they just don't want to add the annotations in order for the authentication to take place. Yes, if some users add |
Could the extensions have a build time transformer that adds For my use case, I think the current configuration option ( I just thought I'd mention this as I've recently noticed that |
If you are using JAX-RS you will be able to use |
Hey there, sorry to bump this issue but I ve encounter a strange behavior. I ve set as the documentation shows the quarkus.http.auth."permission".policy to authenticated with the appropriate paths and I m using the oidc package. So here is the problem : when I pass a good token, the server returns 200, when I pass a bad token the server returns 401. But if I don t pass a token the server retruns 200. This is with quarkus 2.9.2 I believe and my end point does not have any annotation ( role allowed authenticated ). In this case I m expecting to receive a 401. What if there is only one? |
@fleyer that's way to little information, at the very least, I'd require all your config options. Please open dedicated issue with reproducer. Thank you |
Description
Lets consider a case where only the authenticated users can access a given endpoint. At the moment, one has to enable the
SecurityIdentity
-providing module, example,quarkus-oidc
and express a requirement that the authentication is required (inapplication.properties
, see below, or with@Authenticated
):This is a process familiar to a good number of developers. However I propose that we take an opinionated approach (it is Quarkus, right :-) ? ) and say that: if you are planning to properly protect your application, you don't have to do 2 steps only 1 step, and if you are still interested in the semi-secured approach then well, please do Step 2 and tell Quarkus which paths are not secure.
See, we have a lot of flexibility in allowing the anonymous requests in, but ultimately, it is not a good pattern for any application where the security matters. Any anonymous request is a DOS threat. And in general we should encourage the users to take it seriously, as opposed to making it super easy to enter the endpoint URL space, with exactly the opposite to what is proposed: if you are planning to properly protect your application, you have to do 2 steps , and if you are still interested in the semi-secured approach then yeah, don't worry about Step 2 :-)
It may be different from what Spring Security or other frameworks do OOB, but may be it is not a bad thing :-)
This is why IMHO we should try it out for 1.1.0 and make it easier for the users who want to make sure the security is tight OOB. Lets give it a go and collect the feedback and see what we get. I can expect some people say, oh, now my
/health
method can not be invoked, we say - sure, just add a 'permit' policy for it, but then some users may notice their configuration can actually become simpler. We doc this is a trial and will revert if the majority of the users will simply say no, we can't do it...Implementation ideas
Not sure yet, but perhaps
quarkus-oidc
/etc can provide say SecurityIdentityEnabledBuildItem if it s enabled.CC @stuartwdouglas @pedroigor and everyone else who is interested :-)
The text was updated successfully, but these errors were encountered: