From e4fe5ee7ea1dd0bd63c92a0d2632c14b517df395 Mon Sep 17 00:00:00 2001 From: Carter Tinney Date: Fri, 29 May 2020 17:34:44 -0700 Subject: [PATCH] Removed SasTokenRenewalStage from HTTPPipeline --- .../iot/device/iothub/pipeline/http_pipeline.py | 14 +++++++++++++- .../tests/iothub/pipeline/test_http_pipeline.py | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/azure-iot-device/azure/iot/device/iothub/pipeline/http_pipeline.py b/azure-iot-device/azure/iot/device/iothub/pipeline/http_pipeline.py index 35503bb23..9e6234f05 100644 --- a/azure-iot-device/azure/iot/device/iothub/pipeline/http_pipeline.py +++ b/azure-iot-device/azure/iot/device/iothub/pipeline/http_pipeline.py @@ -38,9 +38,21 @@ def __init__(self, pipeline_configuration): :param auth_provider: The authentication provider :param pipeline_configuration: The configuration generated based on user inputs """ + # NOTE: This pipeline DOES NOT handle SasToken management! + # (i.e. using a SasTokenRenewalStage) + # It instead relies on the parallel MQTT pipeline to handle that. + # + # Because they share a pipeline configuration, and MQTT has renewal logic we can be sure + # that the SasToken in the pipeline configuration is valid. + # + # Furthermore, because HTTP doesn't require constant connections or long running tokens, + # there's no need to reauthorize connections, so we can just pass the token from the config + # when needed for auth. + # + # This is not an ideal solution, but it's the simplest one for the time being. + self._pipeline = ( pipeline_stages_base.PipelineRootStage(pipeline_configuration) - .append_stage(pipeline_stages_base.SasTokenRenewalStage()) .append_stage(pipeline_stages_iothub_http.IoTHubHTTPTranslationStage()) .append_stage(pipeline_stages_http.HTTPTransportStage()) ) diff --git a/azure-iot-device/tests/iothub/pipeline/test_http_pipeline.py b/azure-iot-device/tests/iothub/pipeline/test_http_pipeline.py index 678bb8645..fff0f544e 100644 --- a/azure-iot-device/tests/iothub/pipeline/test_http_pipeline.py +++ b/azure-iot-device/tests/iothub/pipeline/test_http_pipeline.py @@ -67,7 +67,6 @@ def test_pipeline_configuration(self, pipeline_configuration): expected_stage_order = [ pipeline_stages_base.PipelineRootStage, - pipeline_stages_base.SasTokenRenewalStage, pipeline_stages_iothub_http.IoTHubHTTPTranslationStage, pipeline_stages_http.HTTPTransportStage, ]