From cdd7053718c9de6afbeaab7bbc78f127dbfc5dcc Mon Sep 17 00:00:00 2001 From: Scott Schaab Date: Fri, 22 Sep 2017 09:46:45 -0700 Subject: [PATCH] hard coding Authorization header auth scheme to 'Bearer' to work around a server side bug in validating the Authorization header --- .../azure/keyvault/custom/key_vault_authentication.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py b/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py index ad799308c2b6..faf7b16e052e 100644 --- a/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py +++ b/azure-keyvault/azure/keyvault/custom/key_vault_authentication.py @@ -123,7 +123,11 @@ def set_authorization_header(self, request, challenge): challenge.get_authorization_server(), challenge.get_resource(), challenge.get_scope()) - request.headers['Authorization'] = '{} {}'.format(auth[0], auth[1]) + + # Due to limitations in the service we hard code the auth scheme to 'Bearer' as the service will fail with any other + # scheme or a different casing such as 'bearer', once this is fixed the following line should be replace with: + # request.headers['Authorization'] = '{} {}'.format(auth[0], auth[1]) + request.headers['Authorization'] = '{} {}'.format('Bearer', auth[1]) class KeyVaultAuthentication(OAuthTokenAuthentication):