-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support for OIDC API Auth and OIDC integration tests #16977
Conversation
4ed3131
to
273266d
Compare
eaade6f
to
28a015b
Compare
Please Merge, this will help us a lot. |
@@ -295,6 +295,13 @@ def by_api_key(self, api_key: str, sa_session=None): | |||
raise exceptions.AuthenticationFailed("Provided API key has expired.") | |||
return provided_key.user | |||
|
|||
def by_oidc_access_token(self, access_token: str): | |||
if hasattr(self.app, "authnz_manager") and self.app.authnz_manager: |
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.
It might be more explicit to find which type of app we need (is it UniverseApplication
) with an isinstance check ?
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.
Yeah, it's not great, I've simply followed the pattern used elsewhere. This is because authnz_manager is assigned conditionally even in the UniverseApplication constructor and is undefined by default. This is something that should probably be handled during the proposed refactoring run.
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 really good, can you resolve this conflict @nuwang ?
Thanks for reviewing @mvdbeek. Have fixed the conflict. |
# Sets the prefix for OIDC scopes specific to this Galaxy instance. | ||
# If an API call is made against this Galaxy instance using an OIDC bearer token, | ||
# it must include a scope with "<prefix>:*". e.g "https://galaxyproject.org/api:*" | ||
#oidc_scope_prefix: https://galaxyproject.org/api |
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.
Is the :* missing here?
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.
The config setting should specify only the prefix. The *
is the exact scope that's requested, meaning all permissions. That leaves space for future expansion, like perhaps <prefix>:datasets
to request access to datasets etc. For now, we only support <prefix>:*
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.
Should then e.g "https://galaxyproject.org/api" be changed
to be clear?
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.
I've expanded the description a bit. Let me know whether this looks better.
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.
Cool, thanks a lot!
Thanks all for the comments and feedback. |
Youhou, it seems also very usefull for our french earth-system/biodiversity/climate Gaia Data project, where we will deploy a keycloack solution who can benefit from this if I am not wrong |
Hmm, I've been looking into adding tests for #17516, but the tests don't look clean:
It's unclear if that's just a consequence of not having passed proper credentials to the test interactor, or something's really broken. |
If you're testing PSA, a probably cause for this is that galaxy/lib/galaxy/authnz/__init__.py Line 91 in 566731b
|
No, that's just the literal test added here: |
This PR adds support for the following:
HTTPBearer is displayed as an auth option in the swagger UI.
How to test the changes?
(Select all options that apply)
License