File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/posit/connect/external Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1212from ..oauth import Credentials
1313from .external import is_local
1414
15+ import requests
16+
1517POSIT_OAUTH_INTEGRATION_AUTH_TYPE = "posit-oauth-integration"
1618
1719# The Databricks SDK CredentialsProvider == Databricks SQL HeaderFactory
@@ -78,6 +80,24 @@ def _get_auth_type(local_auth_type: str) -> str:
7880
7981 return POSIT_OAUTH_INTEGRATION_AUTH_TYPE
8082
83+ class PositLocalContentCredentialsProvider :
84+
85+ def __init__ (self , token_endpoint_url : str , client_id : str , client_secret : str ):
86+ self ._token_endpoint_url = token_endpoint_url
87+ self ._client_id = client_id
88+ self ._client_secret = client_secret
89+
90+ def __call__ (self ) -> Dict [str , str ]:
91+ response = requests .post (
92+ self ._token_endpoint_url ,
93+ auth = (self ._client_id , self ._client_secret ),
94+ data = {
95+ "grant_type" : "client_credentials" ,
96+ "scope" : "all-apis" ,
97+ },
98+ )
99+ credentials = Credentials (** response .json ())
100+ return _new_bearer_authorization_header (credentials )
81101
82102class PositContentCredentialsProvider :
83103 """`CredentialsProvider` implementation which initiates a credential exchange using a content-session-token.
You can’t perform that action at this time.
0 commit comments