Add OIDC provider methods and ID token validation#3580
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3580 +/- ##
==========================================
- Coverage 65.77% 65.76% -0.02%
==========================================
Files 411 411
Lines 40727 40805 +78
==========================================
+ Hits 26790 26834 +44
- Misses 11856 11881 +25
- Partials 2081 2090 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JAORMX
reviewed
Feb 4, 2026
Collaborator
JAORMX
left a comment
There was a problem hiding this comment.
Good work on the OIDC validation. A few thoughts on the security flow.
tgrunnagle
reviewed
Feb 5, 2026
tgrunnagle
reviewed
Feb 5, 2026
tgrunnagle
previously approved these changes
Feb 5, 2026
This implements the remaining OIDC provider functionality building on the OIDCProvider type. The changes add WithNonce authorization option for replay attack prevention, AuthorizationURL with OIDC-specific parameters (nonce, prompt), ExchangeCode with mandatory ID token validation per OIDC Core spec section 3.1.3.3, and RefreshTokens with optional ID token validation per section 12.2. The validateIDToken function uses the go-oidc library verifier to ensure proper token validation. Comprehensive tests cover all new methods using table-driven patterns. This is part of the larger auth-proxy effort to add proper OIDC upstream support to the embedded auth server. It follows the initial OIDC provider type addition and will be followed by integration tests that verify the end-to-end OIDC flow, and then config pipeline changes that preserve the OIDC provider type through the authserver configuration so that OIDC-specific features like ID token validation are available at runtime. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Wrap validateIDToken error for debugging context (reviewer feedback) - Clarify ExchangeCode nonce deferral with accurate comments - Use validateIDToken consistently in ExchangeCode and RefreshTokens instead of calling p.verifier.Verify directly - Document intentional nonce omission in RefreshTokens per Section 12.2 - Add sub claim validation to RefreshTokens per OIDC Core Section 12.2 (sub MUST match original on refresh) with ErrSubjectMismatch sentinel - Update OAuth2Provider interface to accept expectedSubject parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Address review feedback from tgrunnagle: - Add ErrNonceMissing sentinel error for consistency with ErrNonceMismatch and ErrSubjectMismatch (nit about inconsistent error handling) - Validate that openid scope is present in NewOIDCProvider, failing fast with a clear error message instead of cryptic runtime failures when the IDP doesn't return an ID token
aa6eb82 to
244a344
Compare
tgrunnagle
approved these changes
Feb 5, 2026
dmjb
approved these changes
Feb 5, 2026
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
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.
This implements the remaining OIDC provider functionality building on the OIDCProvider type as well as implements OIDC ID token validation.
This PR will be followed by integration tests that verify the end-to-end OIDC flow, and then config pipeline changes that preserve the OIDC provider type through the authserver configuration so that OIDC-specific features like ID token validation are available at runtime.