diff --git a/dapr/clients/grpc/_helpers.py b/dapr/clients/grpc/_helpers.py index 87bdbddc..6a0c27e5 100644 --- a/dapr/clients/grpc/_helpers.py +++ b/dapr/clients/grpc/_helpers.py @@ -159,7 +159,6 @@ def intercept_unary_unary( Returns: A response object after invoking the continuation callable """ - # Pre-process or intercept call new_call_details = self._intercept_call(client_call_details) # Call continuation diff --git a/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py b/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py index 3beffad5..5e94d190 100644 --- a/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py +++ b/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py @@ -22,6 +22,9 @@ from dapr.ext.workflow.workflow_state import WorkflowState from dapr.ext.workflow.workflow_context import Workflow from dapr.ext.workflow.util import getAddress +from dapr.clients.http.client import DAPR_API_TOKEN_HEADER +from dapr.conf import settings + T = TypeVar('T') TInput = TypeVar('TInput') @@ -39,7 +42,10 @@ class DaprWorkflowClient: """ def __init__(self, host: Optional[str] = None, port: Optional[str] = None): address = getAddress(host, port) - self.__obj = client.TaskHubGrpcClient(host_address=address) + metadata = tuple() + if settings.DAPR_API_TOKEN: + metadata = ((DAPR_API_TOKEN_HEADER, settings.DAPR_API_TOKEN),) + self.__obj = client.TaskHubGrpcClient(host_address=address, metadata=metadata) def schedule_new_workflow(self, workflow: Workflow, *, diff --git a/ext/dapr-ext-workflow/dapr/ext/workflow/workflow_runtime.py b/ext/dapr-ext-workflow/dapr/ext/workflow/workflow_runtime.py index c32cd175..2cc25ada 100644 --- a/ext/dapr-ext-workflow/dapr/ext/workflow/workflow_runtime.py +++ b/ext/dapr-ext-workflow/dapr/ext/workflow/workflow_runtime.py @@ -21,6 +21,8 @@ from dapr.ext.workflow.dapr_workflow_context import DaprWorkflowContext from dapr.ext.workflow.workflow_activity_context import Activity, WorkflowActivityContext from dapr.ext.workflow.util import getAddress +from dapr.clients.http.client import DAPR_API_TOKEN_HEADER +from dapr.conf import settings T = TypeVar('T') TInput = TypeVar('TInput') @@ -32,8 +34,12 @@ class WorkflowRuntime: """ def __init__(self, host: Optional[str] = None, port: Optional[str] = None): + metadata = tuple() + if settings.DAPR_API_TOKEN: + metadata = ((DAPR_API_TOKEN_HEADER, settings.DAPR_API_TOKEN),) address = getAddress(host, port) - self.__worker = worker.TaskHubGrpcWorker(host_address=address) + + self.__worker = worker.TaskHubGrpcWorker(host_address=address, metadata=metadata) def register_workflow(self, fn: Workflow): def orchestrationWrapper(ctx: task.OrchestrationContext, inp: Optional[TInput] = None): diff --git a/ext/dapr-ext-workflow/setup.cfg b/ext/dapr-ext-workflow/setup.cfg index 99b7d00a..108e5f8d 100644 --- a/ext/dapr-ext-workflow/setup.cfg +++ b/ext/dapr-ext-workflow/setup.cfg @@ -24,7 +24,7 @@ packages = find_namespace: include_package_data = True install_requires = dapr-dev >= 1.11.0rc1.dev - durabletask >= 0.1.0a2 + durabletask >= 0.1.0a3 [options.packages.find] include =