From 1aeeeb4c274326443eb324948503c39e6713c561 Mon Sep 17 00:00:00 2001 From: Benjamin King Date: Sun, 18 Feb 2018 17:58:36 +0000 Subject: [PATCH 1/4] Fixed an issue when using the test SSO server (login.testeveonline.com). A user's authentication status could not be successfuly verified because the call to the ESI api only used the tranquility datasource --- esipy/security.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/esipy/security.py b/esipy/security.py index dc237fc..e6f77fd 100644 --- a/esipy/security.py +++ b/esipy/security.py @@ -40,10 +40,13 @@ def __init__( :param app: (optionnal) the pyswagger app object :param security_name: (optionnal) the name of the object holding the informations in the securityDefinitions, used to check authed endpoint + :param esi_datasource: (optional) The ESI datasource used to validate + SSO authentication. Defaults to tranquility """ app = kwargs.pop('app', None) sso_url = kwargs.pop('sso_url', "https://login.eveonline.com") esi_url = kwargs.pop('esi_url', "https://esi.tech.ccp.is") + esi_datasource = kwargs.pop('esi_datasource', "tranquility") self.security_name = kwargs.pop('security_name', 'evesso') self.redirect_uri = redirect_uri @@ -86,7 +89,7 @@ def __init__( # use ESI url for verify, since it's better for caching if esi_url is None or esi_url == "": raise AttributeError("esi_url cannot be None or empty") - self.oauth_verify = '%s/verify/' % esi_url + self.oauth_verify = '%s/verify/?datasource=%s' % (esi_url, esi_datasource) # session request stuff self._session = Session() From 64f8b6ea5e2f32d90634a9ec39da146e9c4ab137 Mon Sep 17 00:00:00 2001 From: Benjamin King Date: Sun, 18 Feb 2018 18:10:04 +0000 Subject: [PATCH 2/4] Fixing some whitespace issues --- esipy/security.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esipy/security.py b/esipy/security.py index e6f77fd..8c9fb61 100644 --- a/esipy/security.py +++ b/esipy/security.py @@ -46,7 +46,7 @@ def __init__( app = kwargs.pop('app', None) sso_url = kwargs.pop('sso_url', "https://login.eveonline.com") esi_url = kwargs.pop('esi_url', "https://esi.tech.ccp.is") - esi_datasource = kwargs.pop('esi_datasource', "tranquility") + esi_datasource = kwargs.pop('esi_datasource', "tranquility") self.security_name = kwargs.pop('security_name', 'evesso') self.redirect_uri = redirect_uri @@ -89,7 +89,7 @@ def __init__( # use ESI url for verify, since it's better for caching if esi_url is None or esi_url == "": raise AttributeError("esi_url cannot be None or empty") - self.oauth_verify = '%s/verify/?datasource=%s' % (esi_url, esi_datasource) + self.oauth_verify = '%s/verify/?datasource=%s' % (esi_url, esi_datasource) # session request stuff self._session = Session() From 7b20133cb3ee57edff6eff0965fbc7b0205a8f08 Mon Sep 17 00:00:00 2001 From: Benjamin King Date: Sun, 18 Feb 2018 18:16:30 +0000 Subject: [PATCH 3/4] Added line wrapping --- esipy/security.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/esipy/security.py b/esipy/security.py index 8c9fb61..0029be9 100644 --- a/esipy/security.py +++ b/esipy/security.py @@ -89,7 +89,10 @@ def __init__( # use ESI url for verify, since it's better for caching if esi_url is None or esi_url == "": raise AttributeError("esi_url cannot be None or empty") - self.oauth_verify = '%s/verify/?datasource=%s' % (esi_url, esi_datasource) + self.oauth_verify = '%s/verify/?datasource=%s' % ( + esi_url, + esi_datasource + ) # session request stuff self._session = Session() From 48f3cf2cc84e5e3d1a3b4215b3838c6b964f3007 Mon Sep 17 00:00:00 2001 From: Benjamin King Date: Sun, 18 Feb 2018 18:28:28 +0000 Subject: [PATCH 4/4] Fixed a failing test, and added some coverage for the new EsiSecurity object parameter --- test/test_security.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/test_security.py b/test/test_security.py index 5941e2e..f51c03f 100644 --- a/test/test_security.py +++ b/test/test_security.py @@ -26,7 +26,7 @@ class TestEsiSecurity(unittest.TestCase): CALLBACK_URI = "https://foo.bar/baz/callback" LOGIN_EVE = "https://login.eveonline.com" - OAUTH_VERIFY = "https://esi.tech.ccp.is/verify/" + OAUTH_VERIFY = "https://esi.tech.ccp.is/verify/?datasource=tranquility" OAUTH_TOKEN = "%s/oauth/token" % LOGIN_EVE OAUTH_AUTHORIZE = "%s/oauth/authorize" % LOGIN_EVE CLIENT_ID = 'foo' @@ -114,12 +114,13 @@ def test_esisecurity_other_init(self): client_id=TestEsiSecurity.CLIENT_ID, secret_key=TestEsiSecurity.SECRET_KEY, sso_url='foo.com', - esi_url='bar.baz' + esi_url='bar.baz', + esi_datasource='singularity' ) self.assertEqual( security.oauth_verify, - "bar.baz/verify/" + "bar.baz/verify/?datasource=singularity" ) self.assertEqual( security.oauth_token,