-
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
Do not require IdentityProviders for HTTP Authentication mechanisms without credential types and fail if the required provider is missing #38842
Conversation
Hey @michalvavrik IMHO there should only be 2 small code changes: 1. Remove the check which blocks Also if you don't mind we should add a small section to the top of the Custom |
Thank you for detailed comment. I was afraid that what you suggest has potential for breaking change as till now, if someone added an extension with
That is already happening.
That can't be done inside I'll try to add docs comment as well and I'm sure we will iterate on that :-). |
16f04d4
to
e284c3c
Compare
e284c3c
to
5597c2b
Compare
5597c2b
to
979d081
Compare
This comment has been minimized.
This comment has been minimized.
🙈 The PR is closed and the preview is expired. |
This comment has been minimized.
This comment has been minimized.
979d081
to
507ec75
Compare
quarkus/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/AuthConfig.java Line 17 in 1fd7006
Furthermore, for such a use case as "default" mechanism it really makes sense to only introduce it when there is required |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @michalvavrik, about to propose a couple of tiny changes only
Appreciated, but I'll also push changes related to basic auth as there is too many tests failing. You will need to review again, sorry. |
Well, lets not fail then if the match does not exist if it is so tricky to untangle it for the basic mechanism, have a look though if it might be a test specific issue |
69947f1
to
379277e
Compare
I think almost all test failed in Vert.x HTTP module so I'm pretty sure it is not test specific. But TBH I stopped testing after dozen of them. The root cause is that basic authentication mechanism is added almost always unless you use |
...rtx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticator.java
Show resolved
Hide resolved
...untime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java
Outdated
Show resolved
Hide resolved
...untime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java
Outdated
Show resolved
Hide resolved
...untime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java
Outdated
Show resolved
Hide resolved
...untime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java
Outdated
Show resolved
Hide resolved
mechanisms.add(mechanism); | ||
} else if (!BasicAuthenticationMechanism.class.equals(mechanism.getClass())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michalvavrik I propose to do a warning for all cases just so that we indeed avoid breaking something, appreciate your concern, rather than have mechanism specific exclusions. Warning should be fine because if the basic authentication is enabled by default but no matching identity provider exists it is still not working. Or how about debug level message for Basic if the warning would be too noisy but do warn for every other mechanism ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a tough one, I think I found right solution but please fight back if you disagree.
- It is absolutely fine and user friendly to fail with an exception if mechanism is enabled explicitly or added by user but required identity provider is not there. Therefore I thrown an exception there.
- Basic auth mechanism is added very often, we might need to refactor that in the future, but as long as it is added by default we shouldn't fail as it would be super breaking change. And user didn't explicitly require that mechanism. Therefore it is ignored with debug logging.
- If basic auth mechanism is explicitly enabled but no provider was found, we should fail a build as it is good information for user.
I only run tests in Vert.x HTTP and Elytron properties modules, so let's see what CI thinks about that as well.
This comment has been minimized.
This comment has been minimized.
379277e
to
0b1f985
Compare
0b1f985
to
65f47c0
Compare
Status for workflow
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, lets have it settled on main, IMHO this is effectively a hardening fix which will help users find problems with their custom mechanisms
Status for workflow
|
closes: #38508