Add OAuth authorization server integration tests#3531
Merged
Conversation
Add integration test for the full OAuth 2.0 Authorization Code flow with PKCE using mockoidc as the upstream IDP. TestIntegration_FullPKCEFlow validates the complete OAuth flow including authorization through the upstream IDP, client state preservation, token exchange with PKCE verification, and refresh token issuance via the offline_access scope. The test also verifies RFC 8707 resource parameter handling for audience binding and comprehensive JWT claims (iss, sub, aud, iat, exp, scp).
2fc4b0a to
fd666fb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3531 +/- ##
==========================================
- Coverage 65.35% 65.31% -0.04%
==========================================
Files 403 403
Lines 39210 39210
==========================================
- Hits 25625 25610 -15
- Misses 11599 11614 +15
Partials 1986 1986 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
yrobla
reviewed
Jan 30, 2026
yrobla
reviewed
Jan 30, 2026
yrobla
reviewed
Jan 30, 2026
yrobla
previously approved these changes
Jan 30, 2026
Contributor
yrobla
left a comment
There was a problem hiding this comment.
approved with some comments
Remove defer resp.Body.Close() from parseTokenResponse since the caller (exchangeCodeForTokens) is responsible for closing the body. Following Go's convention that the caller of the function returning an *http.Response owns the resource and handles cleanup. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Check that each element in the scp claim array is a string, consistent with how the outer array type assertion is validated. Provides a clear test failure message instead of a panic if the token structure is unexpected. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove intermediate variable assignment and return the result directly, following idiomatic Go style. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
yrobla
approved these changes
Feb 2, 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.
Add integration test for the full OAuth 2.0 Authorization Code flow with PKCE using mockoidc as the upstream IDP.
TestIntegration_FullPKCEFlow validates the complete OAuth flow including authorization through the upstream IDP, client state preservation, token exchange with PKCE verification, and refresh token issuance via the offline_access scope. The test also verifies RFC 8707 resource parameter handling for audience binding and comprehensive JWT claims (iss, sub, aud, iat, exp, scp).