Skip to content
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

Enabling OAuth for the origin and cache, adding support for Globus as another auth server #963

Merged
merged 16 commits into from
Apr 9, 2024

Conversation

haoming29
Copy link
Contributor

@haoming29 haoming29 commented Mar 19, 2024

Closes #928

This PR also added API support for OAuth login for cache.

To accommodate the second OAuth provider, the login and callback urls for OAuth have breaking changes. This time we can barely do a backward compatible change due to the fact that the redirect URL as part of the shared OAuth configuration can't be changed in between different gin router handler (i.e. /auth/cilogon/login VS /auth/oauth/login).

Now the endpoints are renamed from /auth/cilogon/login and /auth/cilogon/callback to /auth/oauth/login and /auth/oauth/callback respectively.

This breaking change is documented in the Swagger and should be highlighted in the release notes too.

Another deprecate action is the Registry.AdminUsers, which is renamed to OIDC.AdminUsers. This is still backward-compatible.

This PR also addressed the first issue listed in #631 where if we have more than one server running, we direct user to login even if server(s) with a public-view are enabled (such as registry/director)

This PR also enforced the permission check on web pages, where the public can only access /view/director, /view/registry, and / page. For other pages, attempting to access without admin privilege will result in a 403 error with a string "You don't have the permission to view this page. If you think this is wrong, please contact your server admin.".

@haoming29 haoming29 added origin Issue relating to the origin component enhancement New feature or request labels Mar 19, 2024
@haoming29 haoming29 added this to the v7.7.0 milestone Mar 19, 2024
@haoming29 haoming29 requested a review from bbockelm March 22, 2024 22:00
@haoming29 haoming29 linked an issue Mar 27, 2024 that may be closed by this pull request
@haoming29 haoming29 changed the title Enabling OAuth for the origin, adding support for Globus as another auth server Enabling OAuth for the origin and cache, adding support for Globus as another auth server Mar 28, 2024
@haoming29 haoming29 added the critical High priority for next release label Apr 1, 2024
@haoming29
Copy link
Contributor Author

@bbockelm any chance that I could get a review in soon? since this is a critical item for 7.7 release and Cannon's login UI change also depends on this PR to be merged, or do you want to hand this off to someone else?

@haoming29 haoming29 mentioned this pull request Apr 2, 2024
Copy link
Collaborator

@bbockelm bbockelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor changes requested. Some of the formatting nitpicks I fixed up already in a pushed commit.

config/issuer_metadata.go Show resolved Hide resolved
docs/parameters.yaml Outdated Show resolved Hide resolved
docs/parameters.yaml Show resolved Hide resolved
docs/parameters.yaml Outdated Show resolved Hide resolved
oauth2/oidc_client.go Show resolved Hide resolved
web_ui/oauth2_client.go Outdated Show resolved Hide resolved
@haoming29 haoming29 requested a review from bbockelm April 5, 2024 16:29
@haoming29
Copy link
Contributor Author

@CannonLock as I was going over the code to address the code review comments, I realized that I didn't use Origin.EnableOIDC flag that we meant to use for conditionally turn on the OAuth for origin (and cache), so we need to update the UI as well to conditionally render the OAuth options based on the server config. To make your life easier, I have an API included in this PR at /api/v1.0/auth/oauth, a GET request will give you an object with key oidc_enabled_servers which is a list of servers that enable OAuth (also documented in the Swagger). You should be able to iterate over the enabledServers list and match the oidc_enabled_servers to see which server turns on the option. Let me know if that makes sense

@haoming29
Copy link
Contributor Author

Hey @bbockelm, could you take another look at this PR? This one is blocking the release

Copy link
Collaborator

@bbockelm bbockelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revisions LGTM.

@haoming29 haoming29 merged commit 277c6a6 into PelicanPlatform:main Apr 9, 2024
19 checks passed
@haoming29 haoming29 deleted the oauth-for-origin branch April 9, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical High priority for next release enhancement New feature or request origin Issue relating to the origin component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable OAuth for origin
2 participants