From 0ff54f9161c40bf2452bbf00b51534b6f4b3f590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Santos?= Date: Fri, 4 Mar 2016 12:29:34 +0100 Subject: [PATCH] #148 Remove usage of HTTP_TOKENINFO_URL environment variable --- connexion/decorators/security.py | 8 ++------ examples/oauth2/app.yaml | 2 +- tests/decorators/test_security.py | 3 --- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/connexion/decorators/security.py b/connexion/decorators/security.py index 2f8c165d3..e4f54221f 100644 --- a/connexion/decorators/security.py +++ b/connexion/decorators/security.py @@ -37,12 +37,8 @@ def get_tokeninfo_url(security_definition): >>> get_tokeninfo_url({'x-tokenInfoUrl': 'foo'}) 'foo' ''' - token_info_url = security_definition.get('x-tokenInfoUrl') or \ - os.environ.get('HTTP_TOKENINFO_URL') or \ - os.environ.get('TOKENINFO_URL') - # https://github.com/zalando/connexion/issues/148 - if token_info_url and token_info_url == os.environ.get('HTTP_TOKENINFO_URL'): - logger.warn('The HTTP_TOKENINFO_URL environment variable is deprecated. Please use TOKENINFO_URL instead.') + token_info_url = (security_definition.get('x-tokenInfoUrl') or + os.environ.get('TOKENINFO_URL')) return token_info_url diff --git a/examples/oauth2/app.yaml b/examples/oauth2/app.yaml index 22a07aa67..6d01a3a27 100644 --- a/examples/oauth2/app.yaml +++ b/examples/oauth2/app.yaml @@ -24,7 +24,7 @@ securityDefinitions: flow: implicit authorizationUrl: https://example.com/oauth2/dialog # the token info URL is hardcoded for our mock_tokeninfo.py script - # you can also pass it as an environment variable HTTP_TOKENINFO_URL + # you can also pass it as an environment variable TOKENINFO_URL x-tokenInfoUrl: http://localhost:7979/tokeninfo scopes: uid: Unique identifier of the user accessing the service. diff --git a/tests/decorators/test_security.py b/tests/decorators/test_security.py index 18c1403f3..2f0af320b 100644 --- a/tests/decorators/test_security.py +++ b/tests/decorators/test_security.py @@ -14,9 +14,6 @@ def test_get_tokeninfo_url(monkeypatch): env['TOKENINFO_URL'] = 'issue-146' assert get_tokeninfo_url(security_def) == 'issue-146' logger.warn.assert_not_called() - env['HTTP_TOKENINFO_URL'] = 'foo' - assert get_tokeninfo_url(security_def) == 'foo' - logger.warn.assert_called_once_with('The HTTP_TOKENINFO_URL environment variable is deprecated. Please use TOKENINFO_URL instead.') logger.warn.reset_mock() security_def = {'x-tokenInfoUrl': 'bar'} assert get_tokeninfo_url(security_def) == 'bar'