-
Notifications
You must be signed in to change notification settings - Fork 31
Add support for GitHub OAuth2 authentication #2901
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copilot
AI
changed the title
[WIP] Add support for authenticating via GitHub
Add support for GitHub OAuth2 authentication
Dec 19, 2025
- Fix OIDC.Issuer from overriding explicitly set endpoints - Handle missing ID token gracefully (check for empty string) - Make sub claim configurable and optional (fallback to username) - Make issuer claim configurable and optional (fallback to OIDC.Issuer) - Support numeric subject claims (like GitHub's user ID) - Add configuration parameters Issuer.OIDCSubjectClaim and Issuer.OIDCIssuerClaim - Add tests for endpoint override behavior Co-authored-by: bbockelm <[email protected]>
- Remove tests that require database setup - Add comprehensive GitHub OAuth2 configuration example - Update OIDC.Issuer parameter description with GitHub notes - All tests passing and build successful Co-authored-by: bbockelm <[email protected]>
- Use int64 conversion for numeric IDs to avoid floating-point precision issues - Use url.URL struct for proper URL construction instead of string concatenation - Add comments explaining sync.Once reset in tests - All tests passing and build successful Co-authored-by: bbockelm <[email protected]>
Implement 'github' GroupSource type that fetches GitHub organization memberships via the /user/orgs API and uses them as groups for authorization. This enables automatic greenlighting of GitHub org members for token issuance without manual group management. - Add fetchGitHubOrganizations() to query GitHub API - Extend generateUserGroupInfo() to support GitHub group source - Update parameters and example configuration documentation
…s` when OIDC metadata discovery fails. - To support OAuth2-only providers like GitHub.
2ea56f9 to
941b0cf
Compare
h2zh
approved these changes
Jan 12, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pelican assumed OIDC with full discovery support. GitHub implements OAuth2 without OIDC extensions, causing three failure modes: metadata discovery overriding explicit endpoints, ID token parsing crashes, and required OIDC claims (
sub,iss) failing authentication.Changes
Respect explicit endpoint configuration
config/oidc_metadata.go: CheckIsSet()before overwriting endpoints from discovery metadataHandle missing OIDC ID tokens
web_ui/oauth2_client.go: Validate ID token is non-empty string before JWT parsingMake OIDC claims optional with fallbacks
Issuer.OIDCSubjectClaimandIssuer.OIDCIssuerClaim(defaults:sub,iss)OIDC.Issuerconfig or authorization endpoint hostnameExample Configuration
See
docs/github-oauth-config-example.yamlfor complete configuration.Backward compatible: existing OIDC providers (CILogon, Globus) work unchanged.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
abc123/tmp/go-build857477745/b845/config.test /tmp/go-build857477745/b845/config.test -test.testlogfile=/tmp/go-build857477745/b845/testlog.txt -test.paniconexit0 -test.timeout=10m0s -m64 -mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -ato�� g_.a om/!azure/azure-sdk-for-go/sdk/a-ifaceassert ux_amd64/vet -errorsas /storage/remote/--64 -nilfunc ux_amd64/vet(dns block)/tmp/go-build1685999187/b845/config.test /tmp/go-build1685999187/b845/config.test -test.testlogfile=/tmp/go-build1685999187/b845/testlog.txt -test.paniconexit0 -test.timeout=10m0s -m64 -mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -p pkg/mod/go.mongodb.org/[email protected]/bson-p pkg/mod/go.mongodb.org/[email protected]/bsonmain ux_amd64/compile -I /tmp/go-build202--64 -I ux_amd64/compile/tmp/ccGGdC8B.o(dns block)cilogon.org/tmp/go-build2144026736/b001/config.test /tmp/go-build2144026736/b001/config.test -test.testlogfile=/tmp/go-build2144026736/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=TestGetMetadataRespectsExplicitEndpoints --local ux_amd64/compile credential.helpe/opt/hostedtoolcache/go/1.24.11/x64/pkg/tool/linux_amd64/vet(dns block)/tmp/go-build857477745/b845/config.test /tmp/go-build857477745/b845/config.test -test.testlogfile=/tmp/go-build857477745/b845/testlog.txt -test.paniconexit0 -test.timeout=10m0s -m64 -mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -ato�� g_.a om/!azure/azure-sdk-for-go/sdk/a-ifaceassert ux_amd64/vet -errorsas /storage/remote/--64 -nilfunc ux_amd64/vet(dns block)/tmp/go-build1685999187/b845/config.test /tmp/go-build1685999187/b845/config.test -test.testlogfile=/tmp/go-build1685999187/b845/testlog.txt -test.paniconexit0 -test.timeout=10m0s -m64 -mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -p pkg/mod/go.mongodb.org/[email protected]/bson-p pkg/mod/go.mongodb.org/[email protected]/bsonmain ux_amd64/compile -I /tmp/go-build202--64 -I ux_amd64/compile/tmp/ccGGdC8B.o(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.