-
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
When multiple authentication mechanisms are available, http path permission is not working properly #39912
Comments
/cc @pedroigor (bearer-token) |
@Serkan80 You should enable the Basic authentication: https://quarkus.io/guides/security-basic-authentication-howto |
But why does Basic auth work out of the box when I remove the http path config and provide a custom HttpAuthMechism (without explicitly enabling basic auth) ? |
@Serkan80 As far as I know it is enabled by default if no other mechanisms are registered. You just need to enable it explicitly now, can you try it please ? |
We will need to make it clearer in the docs. |
I will try it tomorrow and give you an update. |
Thanks @Serkan80, effectively this @michalvavrik, Hi, I wonder if users do |
@michalvavrik For other mechanisms which are enabled out of the box, it will work, and we do document very clearly that it must be enabled, but users who figured out that it is enabled by default if nothing else is configured, may find it confusing they now have to enable it... |
I checked out reproducer. The basic mechanism exists, but is ignored during the lookup because it is a default bean, it is only not ignored when there is no other mechanism as @sberyozkin pointed out. So it works as expected. I think
We can do that for the annotation, but we can't detect the permission during the build time. However as it exists, we can add it. It will require some special handling just for this mechanism. I think it's alright to do that.
TBH I don't know about anything that changed in this sense. So I am confused with the word |
It should be nice easy job, I'll do it some day when I have just a short time for Quarkus :-) |
@sberyozkin when I explicitly enable basic auth, then it works. But it would be nice if you enable it automatically when you parse this config line:
if basic auth mechanism is available => then set it, otherwise first enable it, then set it (or something). |
makes sense, there are some challenges to this approach, for example if you implement custom authentication mechanism that supports long story short, we can do that when there are no auth mechanisms provided by users, which will fit your case. so ok. |
Describe the bug
I have an issue with how the http path permission works when I have multiple auth. mechanisms.
Basically I have 2 endpoints with different auth. mechanisms:
And when I configure it like this:
The
Principal
object has no username when I call the/auth
endpoint.And if I replace the config above with implementing
HttpAuthenticationMechanism
interface then everything works fine.See also the reproducer here:
https://github.com/Serkan80/quarkus-issue-reproducers/tree/master/http-path-permission-issue
Expected behavior
I expect that the provided config above should work, without the need to implement a custom
HttpAuthenticationMechanism
.Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
jdk 17
Quarkus version or git rev
3.8.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Maven 3.8.6
Additional information
No response
The text was updated successfully, but these errors were encountered: