diff --git a/CHANGES/+auth_header.bugfix b/CHANGES/+auth_header.bugfix new file mode 100644 index 00000000..206c208d --- /dev/null +++ b/CHANGES/+auth_header.bugfix @@ -0,0 +1 @@ +A provided "Authorization" header will no longer be overruled by other authentication mechanisms. diff --git a/pulp-glue/pulp_glue/common/openapi.py b/pulp-glue/pulp_glue/common/openapi.py index 4f430b8f..c9584e1a 100644 --- a/pulp-glue/pulp_glue/common/openapi.py +++ b/pulp-glue/pulp_glue/common/openapi.py @@ -604,7 +604,11 @@ def render_request( "security", self.api_spec.get("security", {}) ) if security and self.auth_provider: - auth = self.auth_provider(security, self.api_spec["components"]["securitySchemes"]) + if "Authorization" in self._session.headers: + # Bad idea, but you wanted it that way. + auth = None + else: + auth = self.auth_provider(security, self.api_spec["components"]["securitySchemes"]) else: # No auth required? Don't provide it. # No auth_provider available? Hope for the best (should do the trick for cert auth).