Skip to content

feat(util): add parallel cloud.google.com/go/auth options and handlers - #197

Merged
agrawalradhika-cell merged 5 commits into
google:masterfrom
agrawalradhika-cell:feat/add-parallel-auth-options-and-handlers
Oct 30, 2026
Merged

agrawalradhika-cell merged 5 commits into
google:masterfrom
agrawalradhika-cell:feat/add-parallel-auth-options-and-handlers

Conversation

@agrawalradhika-cell

@agrawalradhika-cell agrawalradhika-cell commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

As part of the incremental migration from golang.org/x/oauth2 to cloud.google.com/go/auth (following #196), this PR introduces parallel cloud.google.com/go/auth types, helpers, and handlers in util/settings.go, util/pkce.go, and util/auth-handlers.go while keeping all existing golang.org/x/oauth2/authhandler APIs intact and marked deprecated.

Changes

  • util/settings.go & util/fetch.go:
    • Added GoogleAuthHandler auth.AuthorizationHandler to Settings (with precedence documented) and marked AuthHandler authhandler.AuthorizationHandler as Deprecated: Use GoogleAuthHandler instead..
    • Updated Settings.State doc comment to reference GoogleAuthHandler (or the deprecated AuthHandler).
    • Added resolveAuthHandler() on Settings which prefers GoogleAuthHandler and falls back to converting AuthHandler (auth.AuthorizationHandler(s.AuthHandler)), and wired it into FindJSONCredentials in util/fetch.go so callers setting GoogleAuthHandler are honored immediately.
  • util/pkce.go:
    • Added GeneratePKCEOptions() *auth.PKCEOptions using RFC 7636 S256 challenge generation.
    • Retained GeneratePKCEParams() *authhandler.PKCEParams as a deprecated wrapper delegating to GeneratePKCEOptions().
  • util/auth-handlers.go:
    • Added Get3LOAuthHandler(...) auth.AuthorizationHandler.
    • Retained Get3LOAuthorizationHandler(...) authhandler.AuthorizationHandler as a deprecated wrapper delegating to Get3LOAuthHandler(...).
  • Unit Tests:
    • Added util/settings_test.go, util/pkce_test.go, and util/auth-handlers_test.go covering resolveAuthHandler precedence, FindJSONCredentials honoring GoogleAuthHandler, GetAuthType, PKCE challenge derivation (GeneratePKCEOptions & GeneratePKCEParams), and 3LO loopback/OOB handlers (Get3LOAuthHandler & Get3LOAuthorizationHandler).

Testing

  • go test -v ./util/...
  • make build
  • make test

@andyrzhao
andyrzhao self-requested a review October 28, 2026 21:33
andyrzhao
andyrzhao previously approved these changes Oct 28, 2026
@agrawalradhika-cell
agrawalradhika-cell merged commit ab4b776 into google:master Oct 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants