-
Notifications
You must be signed in to change notification settings - Fork 898
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
Move API OIDC/OAuth2 support from API to ManageIQ core #19936
Conversation
@miq-bot assign @abellotti |
@miq-bot add_label refactoring |
4652746
to
e8f495c
Compare
Note: It might be possible to simplify this solution, and eliminate most if not all of the code introduced in this PR, by leveraging OpenID-Connect/OAuth2 setup in the mod_auth_openidc configuration files. Issue 19866 Spec test will be added f it turns out not to be possible to leveraging OpenID-Connect/OAuth2 setup in the mod_auth_openidc configuration files. |
app/models/authenticator/httpd.rb
Outdated
request.headers['X-REMOTE-USER'].present? | ||
def _authenticate(username, password, request) | ||
if !user_data_collected?(request) && request.present? && oidc_configured? | ||
if password.present? |
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.
don't we need to check that username is present instead ?
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.
Will do! Thank you.
Based on review feedback.
@bdunne, @Fryguy and @abellotti I believe I've addressed all of your concerns. I would find it Thank you for your help and feedback. |
I apologies for the full file difference for |
Can you add some tests? |
@bdunne Thank you for the review input. As noted in comment 2 I plan to add tests if it turns out this code can not easily be replaced by OIDC configuration. I don't want to spend time adding tests now for code that just might be removed and the priority is to try to remove it.
|
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 is a moved from api to core.
There are no tests over there.
The shorter term goal is to delete this.
I say merge as is.
You game with this @bdunne ?
Checked commits jvlcek/manageiq@e8f495c~...a517b55 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.20.0, and yamllint |
|
I don't think it was characterized as a simple move. This was a cleanup effort for the original hacked in feature in order to put it in a proper location, and ideally into a dedicated concern should it be removed later. Not much of the actual code should have changed except in light of cleanup.
We are not sure how much effort it will be to replace with the Apache based thing and would prefer to have this "clean" in the jansa release. If we can get the Apache based thing, then yeah, this will go away. It was a toss-up choice and we chose cleanup followed by Apache-based.
I don't think so, and I agree with you that it's probably a good idea to have tests for this stuff... I'd be ok with waiting on merge for some high-level tests. Might have to use a bit of mocking because the way it works it to reach out to a remote identity system. |
@jvlcek Can you please run cross-repo tests with your multiple PRs as well as UI? |
@bdunne Thank you for your perspective! I'm just trying to avoid wasting time on specs now if I can figure out how to get rid of this code. @Fryguy cross-repo tests here: ManageIQ/manageiq-cross_repo-tests#85 |
@bdunne @Fryguy @abellotti and @kbrock Thoughts on merging this? The cross-repo tests passed. Are folks OK with adding specs if the alternative approach turns out not to be possible? |
@jvlcek Does this work roughly the same way as the potential replacement (HTTPD passes us some headers and that means the user is authenticated)? |
It looks like there are tests around the other parts of the authenticate conditional. Added #19866 (comment) as a reminder to add more tests if the replacement is not viable. |
Move API OIDC/OAuth2 support from API to ManageIQ core (cherry picked from commit d8914fb)
Jansa backport details:
|
Fixes #19865
This PR moves the OpenID-Connect support for the API, as implemented with PR 737 and PR 747, from being implemented directly in the ManageIQ API code base to the ManageIQ core authenticator code base.
This PR must be merged along with the associated ManageIQ/manageiq-api
PR 772
Steps for Testing/QA
The below shell commands outline how to perform steps 3 through 5:
[1] https://www.manageiq.org/docs/reference/latest/auth/openid_connect