File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -319,17 +319,18 @@ def env_oidc(cfg) -> Optional[CredentialsProvider]:
319319 if cfg .oidc_token_env :
320320 env_var = cfg .oidc_token_env
321321
322- return _oidc_credentials_provider (cfg , oidc .EnvIdTokenSource (env_var ))
322+ return oidc_credentials_provider (cfg , oidc .EnvIdTokenSource (env_var ))
323323
324324
325325@credentials_strategy ("file-oidc" , ["host" , "oidc_token_filepath" ])
326326def file_oidc (cfg ) -> Optional [CredentialsProvider ]:
327- return _oidc_credentials_provider (cfg , oidc .FileIdTokenSource (cfg .oidc_token_filepath ))
327+ return oidc_credentials_provider (cfg , oidc .FileIdTokenSource (cfg .oidc_token_filepath ))
328328
329329
330- # This function is a helper function to create an OIDC CredentialsProvider
331- # that provides a Databricks token from an IdTokenSource.
332- def _oidc_credentials_provider (cfg , id_token_source : oidc .IdTokenSource ) -> Optional [CredentialsProvider ]:
330+ def oidc_credentials_provider (cfg , id_token_source : oidc .IdTokenSource ) -> Optional [CredentialsProvider ]:
331+ """Creates a CredentialsProvider to sign requests with an OAuth token obtained
332+ by automatically performing the token exchange using the given IdTokenSource."""
333+
333334 try :
334335 id_token_source .id_token () # validate the id_token_source
335336 except Exception as e :
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ def test_oidc_credentials_provider_invalid_id_token_source():
188188 id_token_source = Mock ()
189189 id_token_source .id_token .side_effect = ValueError ("Invalid ID token source" )
190190
191- cp = credentials_provider ._oidc_credentials_provider (mock_cfg , id_token_source )
191+ cp = credentials_provider .oidc_credentials_provider (mock_cfg , id_token_source )
192192 assert cp is None
193193
194194
@@ -216,7 +216,7 @@ def mock_exchange_id_token(id_token: oidc.IdToken):
216216
217217 mocker .patch .object (oidc .DatabricksOidcTokenSource , "_exchange_id_token" , side_effect = mock_exchange_id_token )
218218
219- cp = credentials_provider ._oidc_credentials_provider (mock_cfg , id_token_source )
219+ cp = credentials_provider .oidc_credentials_provider (mock_cfg , id_token_source )
220220 assert cp is not None
221221
222222 # Test that the credentials provider returns the expected headers
You can’t perform that action at this time.
0 commit comments