1515
1616logger = logging .getLogger (__name__ )
1717
18- # Token exchange constants
19- TOKEN_EXCHANGE_PARAMS = {
20- "grant_type" : "urn:ietf:params:oauth:grant-type:token-exchange" ,
21- "scope" : "sql" ,
22- "subject_token_type" : "urn:ietf:params:oauth:token-type:jwt" ,
23- "return_original_token_if_authenticated" : "true" ,
24- }
25-
2618
2719class DatabricksTokenFederationProvider (CredentialsProvider ):
2820 """
@@ -40,6 +32,14 @@ class DatabricksTokenFederationProvider(CredentialsProvider):
4032 "Content-Type" : "application/x-www-form-urlencoded" ,
4133 }
4234
35+ # Token exchange parameters
36+ TOKEN_EXCHANGE_PARAMS = {
37+ "grant_type" : "urn:ietf:params:oauth:grant-type:token-exchange" ,
38+ "scope" : "sql" ,
39+ "subject_token_type" : "urn:ietf:params:oauth:token-type:jwt" ,
40+ "return_original_token_if_authenticated" : "true" ,
41+ }
42+
4343 def __init__ (
4444 self ,
4545 credentials_provider : CredentialsProvider ,
@@ -317,7 +317,7 @@ def _exchange_token(self, access_token: str) -> Token:
317317 ValueError: If token exchange fails
318318 """
319319 # Prepare the request data
320- token_exchange_data = dict (TOKEN_EXCHANGE_PARAMS )
320+ token_exchange_data = dict (self . TOKEN_EXCHANGE_PARAMS )
321321 token_exchange_data ["subject_token" ] = access_token
322322
323323 # Add client_id if provided
0 commit comments