feat: add OAuth Authorization Code + PKCE authentication mode#188
Draft
mkaufmann wants to merge 8 commits into
Draft
feat: add OAuth Authorization Code + PKCE authentication mode#188mkaufmann wants to merge 8 commits into
mkaufmann wants to merge 8 commits into
Conversation
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (75.95%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #188 +/- ##
============================================
- Coverage 82.37% 82.15% -0.22%
- Complexity 1871 1900 +29
============================================
Files 125 128 +3
Lines 5020 5205 +185
Branches 540 562 +22
============================================
+ Hits 4135 4276 +141
- Misses 642 674 +32
- Partials 243 255 +12
🚀 New features to boost your workflow:
|
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.
Summary
authMode=AUTH_CODE_PKCE). The driver opens the user's browser to/services/oauth2/authorize, listens on a loopback HTTP port for the redirect, and exchanges the resulting code for an access token using a per-logincode_verifier. PKCE doesn't apply to the existingpassword/ JWT-bearer /refresh_tokengrants — those don't take acode_verifier— so this is a net-new flow rather than a tweak to an existing one.refreshTokenmode previously required completing the OAuth dance externally and pasting the resulting refresh token into aProperties. WithAUTH_CODE_PKCE, the driver integrates this flowWhat changed (observable)
AUTH_CODE_PKCE, opt-in viaauthMode=AUTH_CODE_PKCE.oauthScope(defaultcdp_query_api api refresh_token),redirectPort(default0= ephemeral; pin to a specific port to match the ECA's registered Callback URL — wildcard ports are not supported),browserAuthTimeoutSeconds(default120).clientSecretis optional for this mode (public-client ECAs don't have one); it's still passed through if set, for confidential ECAs.ExternalClientApplication,ExtlClntAppOauthSettings, andExtlClntAppGlobalOauthSettings.Internals
PkceCodes— RFC 7636 verifier+S256 challenge generator (verified against Appendix B test vector).LoopbackCallbackServer— single-shot127.0.0.1-boundcom.sun.net.httpserverHTTP server. Capturescode/state, surfaces OAutherrorparams, returns a "you can close this tab" page. Closes idempotently.BrowserLauncherinterface —java.awt.Desktop.browse()with stderr fallback for headless environments. Tests inject a fake; production code uses the default.DataCloudTokenProvider.runAuthorizationCodeDance()— orchestrates verifier+challenge+state generation, binds the loopback server, opens the browser, awaits the callback, verifies state (CSRF defense), and stashes the verifier into a one-shotPendingAuthCodeExchangethatbuildAuthenticate()reads on the very next call./services/a360/token) is unchanged — only the OAuth-token leg differs.Out of scope (deliberately)
docs/oauth-flow.md— that's a local-only doc not onmain. The README is the source of truth shipped to customers.