Skip to content

Commit 75f573b

Browse files
RyanLettieriacroca
authored andcommitted
Making token credential optional (microsoft#45)
Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com> Signed-off-by: Albert Callarisa <albert@diagrid.io>
1 parent 6d3ad8f commit 75f573b

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

durabletask-azuremanaged/durabletask/azuremanaged/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Licensed under the MIT License.
33

44
from azure.core.credentials import TokenCredential
5+
from typing import Optional
56

67
from durabletask.azuremanaged.internal.durabletask_grpc_interceptor import \
78
DTSDefaultClientInterceptorImpl
@@ -13,7 +14,7 @@ class DurableTaskSchedulerClient(TaskHubGrpcClient):
1314
def __init__(self, *,
1415
host_address: str,
1516
taskhub: str,
16-
token_credential: TokenCredential,
17+
token_credential: Optional[TokenCredential],
1718
secure_channel: bool = True):
1819

1920
if not taskhub:

durabletask-azuremanaged/durabletask/azuremanaged/internal/durabletask_grpc_interceptor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Licensed under the MIT License.
33

44
import grpc
5+
from typing import Optional
6+
57
from azure.core.credentials import TokenCredential
68

79
from durabletask.azuremanaged.internal.access_token_manager import \
@@ -15,7 +17,7 @@ class DTSDefaultClientInterceptorImpl (DefaultClientInterceptorImpl):
1517
StreamUnaryClientInterceptor and StreamStreamClientInterceptor from grpc to add an
1618
interceptor to add additional headers to all calls as needed."""
1719

18-
def __init__(self, token_credential: TokenCredential, taskhub_name: str):
20+
def __init__(self, token_credential: Optional[TokenCredential], taskhub_name: str):
1921
self._metadata = [("taskhub", taskhub_name)]
2022
super().__init__(self._metadata)
2123

durabletask-azuremanaged/durabletask/azuremanaged/worker.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Licensed under the MIT License.
33

44
from azure.core.credentials import TokenCredential
5+
from typing import Optional
56

67
from durabletask.azuremanaged.internal.durabletask_grpc_interceptor import \
78
DTSDefaultClientInterceptorImpl
@@ -13,7 +14,7 @@ class DurableTaskSchedulerWorker(TaskHubGrpcWorker):
1314
def __init__(self, *,
1415
host_address: str,
1516
taskhub: str,
16-
token_credential: TokenCredential,
17+
token_credential: Optional[TokenCredential],
1718
secure_channel: bool = True):
1819

1920
if not taskhub:

0 commit comments

Comments
 (0)