alexguo-db opened a new pull request, #3177:
URL: https://github.com/apache/arrow-adbc/pull/3177

   ## Motivation
   
   In scenarios like PowerBI dataset refresh, if a query runs longer than the 
OAuth token's expiration time (typically 1 hour for AAD tokens), the connection 
fails. PowerBI only refreshes access tokens if they have less than 20 minutes 
of expiration time and never updates tokens after a connection is opened.
   
   This PR implements token refresh functionality in the Databricks ADBC driver 
using the Databricks token exchange API. When an OAuth token is about to expire 
within a configurable time limit, the driver automatically exchanges it for a 
new token with a longer expiration time.
   
   ## Key Components
   
   1. **JWT Token Decoder**: Parses JWT tokens to extract expiration time
   2. **Token Exchange Client**: Handles API calls to the Databricks token 
exchange endpoint
   3. **Token Exchange Handler**: HTTP handler that intercepts requests and 
refreshes tokens when needed
   
   ## Changes
   
   - Added new connection string parameter `adbc.databricks.token_renew_limit` 
to control when token renewal happens
   - Implemented JWT token decoding to extract token expiration time
   - Created token exchange client to handle API calls to Databricks token 
exchange endpoint
   - Added HTTP handler to intercept requests and refresh tokens when needed
   - Updated connection handling to create and configure the token exchange 
components
   
   ## Testing
   
   - Unit tests for JWT token decoding, token exchange client, and token 
exchange handler
   - End-to-end tests that verify token refresh functionality with real tokens
   
   ```
   dotnet test --filter "FullyQualifiedName~JwtTokenDecoderTests"
   dotnet test --filter "FullyQualifiedName~TokenExchangeClientTests"
   dotnet test --filter "FullyQualifiedName~TokenExchangeDelegatingHandlerTests"
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to