Skip to content

Commit 9f7ea31

Browse files
Remove Github id token source
1 parent 286efee commit 9f7ea31

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

databricks/sdk/oidc.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
from dataclasses import dataclass
1111
from typing import Optional
1212

13-
import requests
14-
1513
from . import oauth
1614

1715
logger = logging.getLogger(__name__)
@@ -125,31 +123,6 @@ def id_token(self) -> IdToken:
125123
return IdToken(jwt=token)
126124

127125

128-
class GitHubIdTokenSource(IdTokenSource):
129-
"""
130-
Supplies OIDC tokens from GitHub Actions.
131-
"""
132-
133-
def __init__(self, request_token: str, request_url: str):
134-
self._request_token = request_token
135-
self._request_url = request_url
136-
137-
def id_token(self, audience: str) -> IdToken:
138-
# See https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-cloud-providers
139-
headers = {"Authorization": f"Bearer {self._request_token}"}
140-
endpoint = f"{self._request_url}&audience={audience}"
141-
response = requests.get(endpoint, headers=headers)
142-
if not response.ok:
143-
raise ValueError(f"Failed to get ID token: {response.status_code} {response.text}")
144-
145-
# get the ID Token with aud=api://AzureADTokenExchange sub=repo:org/repo:environment:name
146-
response_json = response.json()
147-
if "value" not in response_json:
148-
raise ValueError("Missing value in response")
149-
150-
return IdToken(jwt=response_json["value"])
151-
152-
153126
class DatabricksOidcTokenSource(oauth.TokenSource):
154127
"""A TokenSource which exchanges a token using Workload Identity Federation.
155128

0 commit comments

Comments
 (0)