From 4100cb2aeb49dee7458973321cac5c4982f014a2 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 24 Oct 2020 00:07:11 -0700 Subject: [PATCH] Remove discontinued GoogleOpenId backend It was discontinued on the server side in 2015, in favor of OpenID Connect (our GoogleOpenIdConnect backend). https://support.google.com/accounts/answer/6206245 Fixes #462. Fixes #472. Signed-off-by: Anders Kaseorg --- social_core/backends/google.py | 13 --- social_core/tests/backends/test_google.py | 96 ----------------------- 2 files changed, 109 deletions(-) diff --git a/social_core/backends/google.py b/social_core/backends/google.py index 243eedee..3c9a24d5 100644 --- a/social_core/backends/google.py +++ b/social_core/backends/google.py @@ -169,16 +169,3 @@ def get_key_and_secret(self): if key_secret == (None, None): key_secret = ('anonymous', 'anonymous') return key_secret - - -class GoogleOpenId(OpenIdAuth): - name = 'google' - URL = 'https://www.google.com/accounts/o8/id' - - def get_user_id(self, details, response): - """ - Return user unique id provided by service. For google user email - is unique enought to flag a single user. Email comes from schema: - http://axschema.org/contact/email - """ - return details['email'] diff --git a/social_core/tests/backends/test_google.py b/social_core/tests/backends/test_google.py index 015c3e92..bfbf55be 100644 --- a/social_core/tests/backends/test_google.py +++ b/social_core/tests/backends/test_google.py @@ -1,4 +1,3 @@ -import datetime import json import unittest2 @@ -10,7 +9,6 @@ from ..models import User from .oauth import OAuth1Test, OAuth2Test -from .open_id import OpenIdTest from .open_id_connect import OpenIdConnectTestMixin @@ -95,100 +93,6 @@ def test_with_anonymous_key_and_secret(self): self.do_login() -JANRAIN_NONCE = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ') - - -class GoogleOpenIdTest(OpenIdTest): - backend_path = 'social_core.backends.google.GoogleOpenId' - expected_username = 'FooBar' - discovery_body = ''.join([ - '', - '', - '', - '', - 'http://specs.openid.net/auth/2.0/signon', - 'http://openid.net/srv/ax/1.0', - 'http://specs.openid.net/extensions/ui/1.0/mode/popup', - 'http://specs.openid.net/extensions/ui/1.0/icon', - 'http://specs.openid.net/extensions/pape/1.0', - 'https://www.google.com/accounts/o8/ud', - '', - '', - 'http://specs.openid.net/auth/2.0/signon', - 'http://openid.net/srv/ax/1.0', - 'http://specs.openid.net/extensions/ui/1.0/mode/popup', - 'http://specs.openid.net/extensions/ui/1.0/icon', - 'http://specs.openid.net/extensions/pape/1.0', - 'https://www.google.com/accounts/o8/ud?source=mail', - '', - '', - 'http://specs.openid.net/auth/2.0/signon', - 'http://openid.net/srv/ax/1.0', - 'http://specs.openid.net/extensions/ui/1.0/mode/popup', - 'http://specs.openid.net/extensions/ui/1.0/icon', - 'http://specs.openid.net/extensions/pape/1.0', - 'https://www.google.com/accounts/o8/ud?source=gmail.com', - '', - '', - 'http://specs.openid.net/auth/2.0/signon', - 'http://openid.net/srv/ax/1.0', - 'http://specs.openid.net/extensions/ui/1.0/mode/popup', - 'http://specs.openid.net/extensions/ui/1.0/icon', - 'http://specs.openid.net/extensions/pape/1.0', - '', - 'https://www.google.com/accounts/o8/ud?source=googlemail.com', - '', - '', - '', - 'http://specs.openid.net/auth/2.0/signon', - 'http://openid.net/srv/ax/1.0', - 'http://specs.openid.net/extensions/ui/1.0/mode/popup', - 'http://specs.openid.net/extensions/ui/1.0/icon', - 'http://specs.openid.net/extensions/pape/1.0', - 'https://www.google.com/accounts/o8/ud?source=profiles', - '', - '', - '' - ]) - server_response = urlencode({ - 'janrain_nonce': JANRAIN_NONCE, - 'openid.assoc_handle': 'assoc-handle', - 'openid.claimed_id': 'https://www.google.com/accounts/o8/id?' - 'id=some-google-id', - 'openid.ext1.mode': 'fetch_response', - 'openid.ext1.type.email': 'http://axschema.org/contact/email', - 'openid.ext1.type.first_name': 'http://axschema.org/namePerson/first', - 'openid.ext1.type.last_name': 'http://axschema.org/namePerson/last', - 'openid.ext1.type.old_email': 'http://schema.openid.net/contact/email', - 'openid.ext1.value.email': 'foo@bar.com', - 'openid.ext1.value.first_name': 'Foo', - 'openid.ext1.value.last_name': 'Bar', - 'openid.ext1.value.old_email': 'foo@bar.com', - 'openid.identity': 'https://www.google.com/accounts/o8/id?' - 'id=some-google-id', - 'openid.mode': 'id_res', - 'openid.ns': 'http://specs.openid.net/auth/2.0', - 'openid.ns.ext1': 'http://openid.net/srv/ax/1.0', - 'openid.op_endpoint': 'https://www.google.com/accounts/o8/ud', - 'openid.response_nonce': JANRAIN_NONCE + 'by95cT34vX7p9g', - 'openid.return_to': 'http://myapp.com/complete/google/?' - 'janrain_nonce=' + JANRAIN_NONCE, - 'openid.sig': 'brT2kmu3eCzb1gQ1pbaXdnWioVM=', - 'openid.signed': 'op_endpoint,claimed_id,identity,return_to,' - 'response_nonce,assoc_handle,ns.ext1,ext1.mode,' - 'ext1.type.old_email,ext1.value.old_email,' - 'ext1.type.first_name,ext1.value.first_name,' - 'ext1.type.last_name,ext1.value.last_name,' - 'ext1.type.email,ext1.value.email' - }) - - def test_login(self): - self.do_login() - - def test_partial_pipeline(self): - self.do_partial_pipeline() - - class GoogleRevokeTokenTest(GoogleOAuth2Test): def test_revoke_token(self): self.strategy.set_settings({