Skip to content

Commit

Permalink
Remove discontinued GoogleOpenId backend
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
andersk committed Oct 24, 2020
1 parent 9d93069 commit 31d2c20
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 109 deletions.
13 changes: 0 additions & 13 deletions social_core/backends/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
96 changes: 0 additions & 96 deletions social_core/tests/backends/test_google.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import datetime
import json
import unittest2

Expand All @@ -10,7 +9,6 @@

from ..models import User
from .oauth import OAuth1Test, OAuth2Test
from .open_id import OpenIdTest
from .open_id_connect import OpenIdConnectTestMixin


Expand Down Expand Up @@ -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([
'<?xml version="1.0" encoding="UTF-8"?>',
'<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)">',
'<XRD>',
'<Service priority="0">',
'<Type>http://specs.openid.net/auth/2.0/signon</Type>',
'<Type>http://openid.net/srv/ax/1.0</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>',
'<Type>http://specs.openid.net/extensions/pape/1.0</Type>',
'<URI>https://www.google.com/accounts/o8/ud</URI>',
'</Service>',
'<Service priority="10">',
'<Type>http://specs.openid.net/auth/2.0/signon</Type>',
'<Type>http://openid.net/srv/ax/1.0</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>',
'<Type>http://specs.openid.net/extensions/pape/1.0</Type>',
'<URI>https://www.google.com/accounts/o8/ud?source=mail</URI>',
'</Service>',
'<Service priority="10">',
'<Type>http://specs.openid.net/auth/2.0/signon</Type>',
'<Type>http://openid.net/srv/ax/1.0</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>',
'<Type>http://specs.openid.net/extensions/pape/1.0</Type>',
'<URI>https://www.google.com/accounts/o8/ud?source=gmail.com</URI>',
'</Service>',
'<Service priority="10">',
'<Type>http://specs.openid.net/auth/2.0/signon</Type>',
'<Type>http://openid.net/srv/ax/1.0</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>',
'<Type>http://specs.openid.net/extensions/pape/1.0</Type>',
'<URI>',
'https://www.google.com/accounts/o8/ud?source=googlemail.com',
'</URI>',
'</Service>',
'<Service priority="10">',
'<Type>http://specs.openid.net/auth/2.0/signon</Type>',
'<Type>http://openid.net/srv/ax/1.0</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/mode/popup</Type>',
'<Type>http://specs.openid.net/extensions/ui/1.0/icon</Type>',
'<Type>http://specs.openid.net/extensions/pape/1.0</Type>',
'<URI>https://www.google.com/accounts/o8/ud?source=profiles</URI>',
'</Service>',
'</XRD>',
'</xrds:XRDS>'
])
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': '[email protected]',
'openid.ext1.value.first_name': 'Foo',
'openid.ext1.value.last_name': 'Bar',
'openid.ext1.value.old_email': '[email protected]',
'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({
Expand Down

0 comments on commit 31d2c20

Please sign in to comment.