Skip to content

Conversation

@samikshya-db
Copy link
Collaborator

@samikshya-db samikshya-db commented Dec 10, 2025

Description

  • We should be caching the tokens for custom oauth providers
  • This is to incorporate caching as mentioned in the internal code audit
  • There are 2 options to add tokenCache : one is re-using the persistent token cache being used in refresh flow, another is to extend cachedTokenSource (in-memory). The decision is made by benchmarking both : internal doc.
Screenshot 2025-12-12 at 5 18 17 PM

Testing

  • added unit tests

Additional Notes to the Reviewer

@samikshya-db samikshya-db marked this pull request as ready for review December 11, 2025 05:26
this.token =
new Token(
DatabricksJdbcConstants.EMPTY_STRING,
DatabricksJdbcConstants.EMPTY_STRING,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't token exchange happening for every token if host is different? Though the actual token is cached in their own provider, but still exchanged token is not being reused. Can we cache that as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CachedTokenSource will cache this exchanged token - atleast till the time it expires. Or are you pointing at something else?

Copy link
Collaborator

@gopalldb gopalldb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do 1 manual testing for each of affected auth mechanisms?

Copy link
Collaborator

@gopalldb gopalldb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, make sure that you verify these manually

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