Skip to content

Commit 440cd84

Browse files
committed
Address review comments
1 parent 8cac329 commit 440cd84

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Release v0.74.0
44

55
### New Features and Improvements
6+
* Add new auth type (`runtime-oauth`) for notebooks: Introduce a new authentication mechanism that allows notebooks to authenticate using OAuth tokens
67

78
### Security
89

databricks/sdk/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class Config:
113113
disable_experimental_files_api_client: bool = ConfigAttribute(
114114
env="DATABRICKS_DISABLE_EXPERIMENTAL_FILES_API_CLIENT"
115115
)
116+
# TODO: Expose these via environment variables too.
116117
scopes: str = ConfigAttribute()
117118
authorization_details: str = ConfigAttribute()
118119

databricks/sdk/oauth.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,22 @@ def refresh(self) -> Token:
760760

761761
@dataclass
762762
class PATOAuthTokenExchange(Refreshable):
763+
"""Performs OAuth token exchange using a Personal Access Token (PAT) as the subject token.
764+
765+
This class implements the OAuth 2.0 Token Exchange flow (RFC 8693) to exchange a Databricks
766+
Internal PAT Token for an access token with specific scopes and authorization details.
767+
768+
Args:
769+
get_original_token: A callable that returns the PAT to be exchanged. This is a callable
770+
rather than a string value to ensure that a fresh Internal PAT Token is retrieved
771+
at the time of refresh.
772+
host: The Databricks workspace URL (e.g., "https://my-workspace.cloud.databricks.com").
773+
scopes: Space-delimited string of OAuth scopes to request (e.g., "all-apis offline_access").
774+
authorization_details: Optional JSON string containing authorization details as defined in
775+
AuthorizationDetail class above.
776+
disable_async: Whether to disable asynchronous token refresh. Defaults to True.
777+
"""
778+
763779
get_original_token: Callable[[], Optional[str]]
764780
host: str
765781
scopes: str

0 commit comments

Comments
 (0)