From 73aba96743f413d7a621ebe5b3339f3211d73661 Mon Sep 17 00:00:00 2001 From: Hristijan Vilos Date: Wed, 1 Dec 2021 12:22:42 +0100 Subject: [PATCH 01/26] Not logout users when 403 or 404 error occurs --- ckanext/googleauth/plugin.py | 72 +++++++++++++----------------------- 1 file changed, 26 insertions(+), 46 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 075158b..17ec13e 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -1,25 +1,3 @@ -'''This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . - - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed.''' - - - # coding=utf-8 import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit @@ -114,12 +92,12 @@ def get_ckanuser(self, user): #generates a strong password def get_ckanpasswd(self): - import datetime - import random + import datetime + import random - passwd = str(random.random())+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")+str(uuid.uuid4().hex) - passwd = re.sub(r"\s+", "", passwd, flags=re.UNICODE) - return passwd + passwd = str(random.random())+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")+str(uuid.uuid4().hex) + passwd = re.sub(r"\s+", "", passwd, flags=re.UNICODE) + return passwd @@ -148,35 +126,35 @@ def login(self): params = toolkit.request.params - if 'id_token' in params: - try: - mail_verified = self.verify_email(params['id_token']) - except GoogleAuthException, e: - toolkit.abort(500) + if 'id_token' in params: + try: + mail_verified = self.verify_email(params['id_token']) + except GoogleAuthException, e: + toolkit.abort(500) - user_account = email_to_ckan_user(mail_verified) + user_account = email_to_ckan_user(mail_verified) - user_ckan = self.get_ckanuser(user_account) + user_ckan = self.get_ckanuser(user_account) - if not user_ckan: - user_ckan = toolkit.get_action('user_create')( - context={'ignore_auth': True}, - data_dict={'email': mail_verified, - 'name': user_account, - 'password': self.get_ckanpasswd()}) + if not user_ckan: + user_ckan = toolkit.get_action('user_create')( + context={'ignore_auth': True}, + data_dict={'email': mail_verified, + 'name': user_account, + 'password': self.get_ckanpasswd()}) - pylons.session['ckanext-google-user'] = user_ckan['name'] - pylons.session['ckanext-google-email'] = mail_verified + pylons.session['ckanext-google-user'] = user_ckan['name'] + pylons.session['ckanext-google-email'] = mail_verified - #to revoke the Google token uncomment the code below - #pylons.session['ckanext-google-accesstoken'] = params['token'] - pylons.session.save() + #to revoke the Google token uncomment the code below + #pylons.session['ckanext-google-accesstoken'] = params['token'] + pylons.session.save() #if someone is logged in will be set the parameter c.user def identify(self): - user_ckan = pylons.session.get('ckanext-google-user') + user_ckan = pylons.session.get('ckanext-google-user') if user_ckan: toolkit.c.user = user_ckan @@ -186,6 +164,8 @@ def logout(self): self._logout_user() def abort(self, status_code=None, detail='', headers=None, comment=None): + if status_code == 403 or status_code == 404: + return (status_code, detail, headers, comment) self._logout_user() return (status_code, detail, headers, comment) From 29cd1080015317093b32e791ab600399816ff334 Mon Sep 17 00:00:00 2001 From: Hristijan Vilos Date: Wed, 1 Dec 2021 12:54:23 +0100 Subject: [PATCH 02/26] Fix over-indentation --- ckanext/googleauth/plugin.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 17ec13e..cc15c92 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -65,14 +65,14 @@ def verify_email(self, token): res = requests.post('https://www.googleapis.com/oauth2/v3/tokeninfo?id_token='+token, verify=True) if res.ok: - is_email_verified=json.loads(res.content) - if is_email_verified['email_verified'] == 'true': - email_verified = is_email_verified['email'] - return email_verified - else: - raise GoogleAuthException(is_email_verified) + is_email_verified=json.loads(res.content) + if is_email_verified['email_verified'] == 'true': + email_verified = is_email_verified['email'] + return email_verified + else: + raise GoogleAuthException(is_email_verified) else: - raise GoogleAuthException(res) + raise GoogleAuthException(res) @@ -80,13 +80,13 @@ def verify_email(self, token): def get_ckanuser(self, user): import ckan.model - user_ckan = ckan.model.User.by_name(user) + user_ckan = ckan.model.User.by_name(user) - if user_ckan: - user_dict = toolkit.get_action('user_show')(data_dict={'id': user_ckan.id}) - return user_dict - else: - return None + if user_ckan: + user_dict = toolkit.get_action('user_show')(data_dict={'id': user_ckan.id}) + return user_dict + else: + return None From 2a623b2e176a3926154b25a25fda7dd10afabb9e Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Thu, 26 Jan 2023 16:35:15 +0000 Subject: [PATCH 03/26] Enable deprecation warnings for Google sign-in --- ckanext/googleauth/public/base/js/googleauth.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ckanext/googleauth/public/base/js/googleauth.js b/ckanext/googleauth/public/base/js/googleauth.js index e1c7515..4c8a4d0 100644 --- a/ckanext/googleauth/public/base/js/googleauth.js +++ b/ckanext/googleauth/public/base/js/googleauth.js @@ -23,6 +23,9 @@ var googleUser = {}; var cid = getMetaContent('google-signin-client_id'); var hd = getMetaContent('google-signin-hosted_domain'); var startApp = function() { + // https://developers.google.com/identity/gsi/web/guides/migration#identifying_affected_code_and_testing + // Values include 'informational' and 'enforced' + document.cookie = "G_AUTH2_MIGRATION=informational"; gapi.load('auth2', function(){ auth2 = gapi.auth2.init({ client_id: cid, From db72b4a8ecbecbad96a13a24862b9866057bec28 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 22 Mar 2023 21:46:20 +0000 Subject: [PATCH 04/26] WIP: Migrate from Google Sign-In to Google Identify Services Library --- ckanext/googleauth/plugin.py | 42 ++++----- .../googleauth/public/base/js/googleauth.js | 86 ------------------- ckanext/googleauth/templates/base.html | 20 ++--- ckanext/googleauth/templates/user/login.html | 9 +- setup.py | 4 +- 5 files changed, 29 insertions(+), 132 deletions(-) delete mode 100644 ckanext/googleauth/public/base/js/googleauth.js diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index cc15c92..c5e36f6 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -4,6 +4,9 @@ from ckan.lib.plugins import DefaultTranslation import json import uuid + +from google.oauth2 import id_token +from google.auth.transport import requests import pylons import pylons.config as config import ckan.lib.helpers as helpers @@ -50,7 +53,6 @@ class GoogleauthPlugin(plugins.SingletonPlugin, DefaultTranslation): def update_config(self, config_): toolkit.add_template_directory(config_, 'templates') toolkit.add_public_directory(config_, 'public') - toolkit.add_resource('fanstatic', 'googleauth') #declare new helper functions @@ -60,22 +62,6 @@ def get_helpers(self): - #verify email address within token - def verify_email(self, token): - res = requests.post('https://www.googleapis.com/oauth2/v3/tokeninfo?id_token='+token, verify=True) - - if res.ok: - is_email_verified=json.loads(res.content) - if is_email_verified['email_verified'] == 'true': - email_verified = is_email_verified['email'] - return email_verified - else: - raise GoogleAuthException(is_email_verified) - else: - raise GoogleAuthException(res) - - - #if exist returns ckan user def get_ckanuser(self, user): import ckan.model @@ -126,32 +112,34 @@ def login(self): params = toolkit.request.params - if 'id_token' in params: - try: - mail_verified = self.verify_email(params['id_token']) - except GoogleAuthException, e: + if 'credential' in params: + # https://developers.google.com/identity/gsi/web/reference/js-reference#CredentialResponse + # https://developers.google.com/identity/gsi/web/guides/verify-google-id-token + id_info = id_token.verify_oauth2_token( + token, requests.Request(), get_clientid() + ) + if id_info.get('hd', '') != get_hosted_domain(): toolkit.abort(500) - user_account = email_to_ckan_user(mail_verified) + email = id_info['email'] + user_account = email_to_ckan_user(email) - user_ckan = self.get_ckanuser(user_account) + user_ckan = self.get_ckanuser(email) if not user_ckan: user_ckan = toolkit.get_action('user_create')( context={'ignore_auth': True}, - data_dict={'email': mail_verified, + data_dict={'email': email, 'name': user_account, 'password': self.get_ckanpasswd()}) pylons.session['ckanext-google-user'] = user_ckan['name'] - pylons.session['ckanext-google-email'] = mail_verified + pylons.session['ckanext-google-email'] = email #to revoke the Google token uncomment the code below #pylons.session['ckanext-google-accesstoken'] = params['token'] pylons.session.save() - - #if someone is logged in will be set the parameter c.user def identify(self): user_ckan = pylons.session.get('ckanext-google-user') diff --git a/ckanext/googleauth/public/base/js/googleauth.js b/ckanext/googleauth/public/base/js/googleauth.js deleted file mode 100644 index 4c8a4d0..0000000 --- a/ckanext/googleauth/public/base/js/googleauth.js +++ /dev/null @@ -1,86 +0,0 @@ -/*This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as -published by the Free Software Foundation, either version 3 of the -License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . - - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed.*/ - - -var googleUser = {}; -var cid = getMetaContent('google-signin-client_id'); -var hd = getMetaContent('google-signin-hosted_domain'); -var startApp = function() { - // https://developers.google.com/identity/gsi/web/guides/migration#identifying_affected_code_and_testing - // Values include 'informational' and 'enforced' - document.cookie = "G_AUTH2_MIGRATION=informational"; - gapi.load('auth2', function(){ - auth2 = gapi.auth2.init({ - client_id: cid, - cookiepolicy: 'single_host_origin', - hosted_domain: hd - }); - var button = document.getElementById('g-signin-button'); - if (button) { - attachSignin(button); - } - }); -}; - - - -function attachSignin(element) { - auth2.attachClickHandler(element, {}, - function(googleUser) { - - var profile = googleUser.getBasicProfile(); - var name = profile.getName(); - var email = profile.getEmail(); - - var response = googleUser.getAuthResponse(); - var id_token = response['id_token']; - var access_token = response['access_token']; - - $.ajax({ - type: 'POST', - url:'/user/login', - data: {name: name, email: email, id_token: id_token, token: access_token}, - success: function(res, status, xhr) { - window.location.replace("/dashboard"); - }, - error: function(xhr, status, err) { - alert("Login failure: " + err); - } - }); - - }, function(error) { - - - }); - -} - - - -/*get content from meta tag*/ -function getMetaContent(propName) { - var metas = document.getElementsByTagName('meta'); - for (i = 0; i < metas.length; i++) { - if (metas[i].getAttribute("name") == propName) { - return metas[i].getAttribute("content"); - } - } - return ""; -} diff --git a/ckanext/googleauth/templates/base.html b/ckanext/googleauth/templates/base.html index 838d0fa..85a00bd 100644 --- a/ckanext/googleauth/templates/base.html +++ b/ckanext/googleauth/templates/base.html @@ -9,20 +9,12 @@ {% endblock %} -{% block meta %} -{% set ci=h.googleauth_get_clientid() %} -{% set hd=h.googleauth_get_hosted_domain() %} - {{ super() }} - - - -{% endblock %} - - - {% block scripts %} {{ super() }} - - - + + {% endblock %} diff --git a/ckanext/googleauth/templates/user/login.html b/ckanext/googleauth/templates/user/login.html index 50bb07e..f3d0b11 100644 --- a/ckanext/googleauth/templates/user/login.html +++ b/ckanext/googleauth/templates/user/login.html @@ -13,10 +13,11 @@

{{ _('Log in with Google') }}

-
- - Google -
+ {% set ci=h.googleauth_get_clientid() %} + {% comment %}data-login_uri omitted for POST to same page{% endcomment %} +
+
+
diff --git a/setup.py b/setup.py index b17e73a..d43bc4f 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,9 @@ # project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/technical.html#install-requires-vs-requirements-files - install_requires=[], + install_requires=[ + 'google-auth<=1.34.0', + ], # If there are data files included in your packages that need to be # installed, specify them here. If using Python 2.6 or less, then these From aace448dbafecf85f237353f70c1af03e230b8ed Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 22 Mar 2023 22:05:56 +0000 Subject: [PATCH 05/26] Fix template comment --- ckanext/googleauth/templates/user/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/googleauth/templates/user/login.html b/ckanext/googleauth/templates/user/login.html index f3d0b11..f53fa01 100644 --- a/ckanext/googleauth/templates/user/login.html +++ b/ckanext/googleauth/templates/user/login.html @@ -14,7 +14,7 @@

{{ _('Log in with Google') }}

{% set ci=h.googleauth_get_clientid() %} - {% comment %}data-login_uri omitted for POST to same page{% endcomment %} + {# data-login_uri omitted for POST to same page #}
From afa8128d7e95f9978eb6e3f4e3134a7e93de8793 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Fri, 24 Mar 2023 06:44:59 +0000 Subject: [PATCH 06/26] Explicitly set data-login_uri --- ckanext/googleauth/plugin.py | 6 ++++++ ckanext/googleauth/templates/user/login.html | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index c5e36f6..cb0ab14 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -20,6 +20,11 @@ def get_clientid(): return config.get('ckan.googleauth_clientid', '') +def get_loginuri(): + site_url = config.get('ckan.site_url') + return '%s/user/login' % (site_url) + + #get ckan.googleauth_hosted_domain from ini file def get_hosted_domain(): return config.get('ckan.googleauth_hosted_domain', '') @@ -58,6 +63,7 @@ def update_config(self, config_): #declare new helper functions def get_helpers(self): return {'googleauth_get_clientid': get_clientid, + 'googleauth_get_loginuri': get_loginuri, 'googleauth_get_hosted_domain': get_hosted_domain} diff --git a/ckanext/googleauth/templates/user/login.html b/ckanext/googleauth/templates/user/login.html index f53fa01..a2ca356 100644 --- a/ckanext/googleauth/templates/user/login.html +++ b/ckanext/googleauth/templates/user/login.html @@ -14,8 +14,8 @@

{{ _('Log in with Google') }}

{% set ci=h.googleauth_get_clientid() %} - {# data-login_uri omitted for POST to same page #} -
+ {% set uri=h.googleauth_get_loginuri() %} +
From 7f4c49b5fce5b6f8a27fa0eb594d12726d168944 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Fri, 24 Mar 2023 07:06:53 +0000 Subject: [PATCH 07/26] Fix parameter when verifying token --- ckanext/googleauth/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index cb0ab14..f1148da 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -122,7 +122,7 @@ def login(self): # https://developers.google.com/identity/gsi/web/reference/js-reference#CredentialResponse # https://developers.google.com/identity/gsi/web/guides/verify-google-id-token id_info = id_token.verify_oauth2_token( - token, requests.Request(), get_clientid() + params['credential'], requests.Request(), get_clientid() ) if id_info.get('hd', '') != get_hosted_domain(): toolkit.abort(500) From e3740ae10c145ebc6740c6dc5202c6c96afa87d7 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Fri, 24 Mar 2023 10:18:24 +0000 Subject: [PATCH 08/26] Remove obsolete requests import --- ckanext/googleauth/plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index f1148da..2716834 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -10,7 +10,6 @@ import pylons import pylons.config as config import ckan.lib.helpers as helpers -import requests import re From e7a1dd1864d6fb87ec1c6118290eb5538b802530 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Fri, 24 Mar 2023 22:14:31 +0000 Subject: [PATCH 09/26] Fix CKAN user lookup --- ckanext/googleauth/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 2716834..da8a2c1 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -129,7 +129,7 @@ def login(self): email = id_info['email'] user_account = email_to_ckan_user(email) - user_ckan = self.get_ckanuser(email) + user_ckan = self.get_ckanuser(user_account) if not user_ckan: user_ckan = toolkit.get_action('user_create')( From 5fa3057618e62d86cd7dcc86e91966af24a4cbeb Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Sat, 25 Mar 2023 06:26:13 +0000 Subject: [PATCH 10/26] Redirect user to dashboard after login --- ckanext/googleauth/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index da8a2c1..b493044 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -9,7 +9,7 @@ from google.auth.transport import requests import pylons import pylons.config as config -import ckan.lib.helpers as helpers +import ckan.lib.helpers as h import re @@ -151,7 +151,9 @@ def identify(self): if user_ckan: toolkit.c.user = user_ckan - + request = toolkit.request + if request.method == 'POST': + h.redirect_to('/dashboard') def logout(self): self._logout_user() From cf3cf99d6f2303b99c9a5cebeb59aa8f6b682cc3 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Sat, 25 Mar 2023 06:37:50 +0000 Subject: [PATCH 11/26] Redirect to dashboard if user exists --- ckanext/googleauth/plugin.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index b493044..1e4795b 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -151,9 +151,9 @@ def identify(self): if user_ckan: toolkit.c.user = user_ckan - request = toolkit.request - if request.method == 'POST': - h.redirect_to('/dashboard') + request = toolkit.request + if request.method == 'POST': + h.redirect_to('/dashboard') def logout(self): self._logout_user() From 5a1cb914a33f80833a0730c4ed3727c6385a0c23 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Sat, 25 Mar 2023 06:59:33 +0000 Subject: [PATCH 12/26] Try redirecting in login() instead --- ckanext/googleauth/plugin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 1e4795b..ca47ae2 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -145,16 +145,14 @@ def login(self): #pylons.session['ckanext-google-accesstoken'] = params['token'] pylons.session.save() + h.redirect_to('/dashboard') + #if someone is logged in will be set the parameter c.user def identify(self): user_ckan = pylons.session.get('ckanext-google-user') if user_ckan: toolkit.c.user = user_ckan - request = toolkit.request - if request.method == 'POST': - h.redirect_to('/dashboard') - def logout(self): self._logout_user() From 187c7e3d4d55cd844fd66bb26bb8df52ae384be0 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 16:02:17 +0100 Subject: [PATCH 13/26] Remove obsolete public folder --- ckanext/googleauth/plugin.py | 1 - ckanext/googleauth/public/.gitignore | 0 .../googleauth/public/base/css/gbutton.css | 36 ------------------ ckanext/googleauth/public/base/images/g7.png | Bin 6409 -> 0 bytes ckanext/googleauth/templates/base.html | 9 ----- 5 files changed, 46 deletions(-) delete mode 100644 ckanext/googleauth/public/.gitignore delete mode 100644 ckanext/googleauth/public/base/css/gbutton.css delete mode 100644 ckanext/googleauth/public/base/images/g7.png diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index ca47ae2..67ed3ce 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -56,7 +56,6 @@ class GoogleauthPlugin(plugins.SingletonPlugin, DefaultTranslation): def update_config(self, config_): toolkit.add_template_directory(config_, 'templates') - toolkit.add_public_directory(config_, 'public') #declare new helper functions diff --git a/ckanext/googleauth/public/.gitignore b/ckanext/googleauth/public/.gitignore deleted file mode 100644 index e69de29..0000000 diff --git a/ckanext/googleauth/public/base/css/gbutton.css b/ckanext/googleauth/public/base/css/gbutton.css deleted file mode 100644 index b231399..0000000 --- a/ckanext/googleauth/public/base/css/gbutton.css +++ /dev/null @@ -1,36 +0,0 @@ -#g-signin-button { - display: inline-block; - background: #4285f4; - color: white; - width: 190px; - border-radius: 5px; - white-space: nowrap; -} - -#g-signin-button:hover { - cursor: pointer; -} - -span.label { - font-weight: bold; -} - -span.icon { - background: url('/base/images/g7.png') transparent 50% no-repeat; - display: inline-block; - vertical-align: middle; - width: 42px; - height: 42px; - /*border-right: #2265d4 1px solid;*/ -} - -span.button-text { - display: inline-block; - vertical-align: middle; - padding-left: 32px; - padding-right: 32px; - font-size: 14px; - font-weight: bold; - /* Use the Roboto font that is loaded in the */ - font-family: 'Roboto', sans-serif; -} diff --git a/ckanext/googleauth/public/base/images/g7.png b/ckanext/googleauth/public/base/images/g7.png deleted file mode 100644 index 77ba4a7c7f88316ccb2e1c5c3a574bafeec49c71..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6409 zcmV+k8TRIhP)uJ@VVD_UC<6{NG_fI~0ue<-1QkJoA_k0xBC#Thg@9ne9*`iQ#9$Or zQF$}6R&?d%y_c8YA7_1QpS|}zXYYO1x&V;8{kgn!SPFnNo`4_X6{c}T{8k*B#$jdxfFg<9uYy1K45IaYvHg`_dOZM)Sy63ve6hvv z1)yUy0P^?0*fb9UASvow`@mQCp^4`uNg&9uGcn1|&Nk+9SjOUl{-OWr@Hh0;_l(8q z{wNRKos+;6rV8ldy0Owz(}jF`W(JeRp&R{qi2rfmU!TJ;gp(Kmm5I1s5m_f-n#TRsj}B0%?E`vOzxB2#P=n*a3EfYETOrKoe*ICqM@{4K9Go;5xVgZi5G4 z1dM~{UdP6d+Yd3o?MrAqM0Kc|iV92owdyL5UC#5<>aVCa44|hpM4E zs0sQWIt5*Tu0n&*J!lk~f_{hI!w5`*sjxDv4V%CW*ah~3!{C*0BD@;TgA3v9a1~q+ zAA{TB3-ERLHar49hi4Ih5D^-ph8Q6X#0?2VqLBoIkE}zAkxHZUgRb+f=nat zP#6>iMMoK->`~sRLq)(kHo*Vn{;LcG6+edD1=7D>9j^O?D{Qg|tCDK{ym)H7&wDr6*;uGTJg8GHjVbnL{!cWyUB7MT6o-VNo_w8Yq`2<5Ub)hw4L3rj}5@qx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 z0G1amR#e_`^BeiK-S6P_{hop0qc(_dv~c^>h}N;`|-%K3~;bD}D#DJwfmIM~Ta) zFjvRI2u6a&QULmvY|!f~CRL1teExYlNB*4j!hfKp0kN__zhT{V+`DlH64TX=Y2a&$ z|H4V%1})h?g^~+mXyivFsTri4%2<@Bjj`Y zF!6)UwMMA2wYk3ND%aXRS#z+Wi%erqsyVqvacUORv`bt%Ok8{kLcNqoRu33D@vFd= zPmn74l>?+_{)yPVgqcIN?1y}1MUTB^v-Fx^h2R5Oo~3z~M;G(hT3ndRd_IdsF!RH0 z9IggyKNf5N6Y_-v#HFKvA_$7n&bo!STnUyR0~TXlt%)t?C$e_8?OLt&rE}-b?e|H2 z*edk5g6wLr`eT6`hDWn2ST-{#gjU+-RO{lZ-H>ZK|AE0b#CgV(CUIeTfA`YjqPsXV zGym$bAN^-58>hBzBbs*y&TOS^TnS45AK-<-az#}eoLs!f;hER4P+6nvYqY;~1VrV! zvGvqD(&?VR@?>we)p64=pUGZ2c;suZ9KZ6En|L$TT9cTkV1=`0=i09M!|O2vjrff}PuTQ}j5Nmh&dCG( z)ptM6l`Jg*=?eN-z2z8^3R@>Pu{BJPzjpcSGtV9SoAci~^eQWVv$%D~J@tq0t3CXN zJMH&&Zx3(VJf)%P+Gy;QMNueQ{ zbD`|>`Zw5sKZAEPk{ZpJ;ODdD=1(PDqsaZTY! z|JRnN?Q}L<==`vIsrB{N@r&P{KXm#m#YQ*DcysMWQZdDCH;yKiMAii_8$)pG%!*%6 zhO#$&n8+~K#5Zu&O*mhp7gNr*XX)g - - {{ super() }} -{% endblock %} - - {% block scripts %} {{ super() }} From d9e09eebf12f5c923272a54d918d0ee5b93550d9 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 16:02:45 +0100 Subject: [PATCH 14/26] Remove migration warning cookie --- ckanext/googleauth/templates/base.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ckanext/googleauth/templates/base.html b/ckanext/googleauth/templates/base.html index c0372d5..0fafdcb 100644 --- a/ckanext/googleauth/templates/base.html +++ b/ckanext/googleauth/templates/base.html @@ -3,9 +3,4 @@ {% block scripts %} {{ super() }} - {% endblock %} From 5f0b2c34047390bf1c0f0dc6641a55df690b129b Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 17:00:11 +0100 Subject: [PATCH 15/26] Logging --- ckanext/googleauth/plugin.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 67ed3ce..3588fca 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -3,6 +3,7 @@ import ckan.plugins.toolkit as toolkit from ckan.lib.plugins import DefaultTranslation import json +import logging import uuid from google.oauth2 import id_token @@ -12,7 +13,7 @@ import ckan.lib.helpers as h import re - +log = logging.getLogger(__name__) #get 'ckan.googleauth_clientid' from ini file def get_clientid(): @@ -113,24 +114,31 @@ def _logout_user(self): #at every access the email address is checked. if it is authorized ckan username is created and access is given def login(self): + log.debug('login()') params = toolkit.request.params if 'credential' in params: + log.debug('credential in params') # https://developers.google.com/identity/gsi/web/reference/js-reference#CredentialResponse # https://developers.google.com/identity/gsi/web/guides/verify-google-id-token id_info = id_token.verify_oauth2_token( params['credential'], requests.Request(), get_clientid() ) if id_info.get('hd', '') != get_hosted_domain(): + log.debug('Hosted domain mismatch: aborting...') toolkit.abort(500) email = id_info['email'] + log.debug('Email address: %s' % email) + user_account = email_to_ckan_user(email) + log.debug('User account: %s' % user_account) user_ckan = self.get_ckanuser(user_account) if not user_ckan: + log.debug('Creating CKAN user') user_ckan = toolkit.get_action('user_create')( context={'ignore_auth': True}, data_dict={'email': email, @@ -144,6 +152,7 @@ def login(self): #pylons.session['ckanext-google-accesstoken'] = params['token'] pylons.session.save() + log.debug('Redirecting to dashboard') h.redirect_to('/dashboard') #if someone is logged in will be set the parameter c.user From ead99e73deb401f2f71515704be16c0b5d83c356 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 21:15:39 +0100 Subject: [PATCH 16/26] More debugging --- ckanext/googleauth/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 3588fca..7296ddf 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -157,11 +157,14 @@ def login(self): #if someone is logged in will be set the parameter c.user def identify(self): + log.debug('identify()') user_ckan = pylons.session.get('ckanext-google-user') + log.debug('CKAN User: %s' % user_ckan) if user_ckan: toolkit.c.user = user_ckan def logout(self): + log.debug('logout()') self._logout_user() def abort(self, status_code=None, detail='', headers=None, comment=None): From 29fdf93aa75ef0beea9641f0cc0308c40d28baf9 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 21:38:48 +0100 Subject: [PATCH 17/26] Temporarily disable redirect --- ckanext/googleauth/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 7296ddf..49e9adc 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -153,7 +153,7 @@ def login(self): pylons.session.save() log.debug('Redirecting to dashboard') - h.redirect_to('/dashboard') + # h.redirect_to('/dashboard') #if someone is logged in will be set the parameter c.user def identify(self): From 56c057fb899e19701ca7c591e316ae29edb5fe99 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 22:42:07 +0100 Subject: [PATCH 18/26] Restore redirect and dump session info --- ckanext/googleauth/plugin.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 49e9adc..3b48ece 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -150,10 +150,15 @@ def login(self): #to revoke the Google token uncomment the code below #pylons.session['ckanext-google-accesstoken'] = params['token'] + + log.debug('Saving pylons session... %r' % pylons.session) pylons.session.save() + log.debug('Session type: %s' % getattr(pylons.session, "type")) + log.debug('Session dir: %s' % getattr(pylons.session, "data_dir")) + log.debug('Redirecting to dashboard') - # h.redirect_to('/dashboard') + h.redirect_to('/dashboard') #if someone is logged in will be set the parameter c.user def identify(self): From 2efcf15c538ad9741fbebb0c9e44f00a6513ebb2 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 23:06:07 +0100 Subject: [PATCH 19/26] Debug session in identity() --- ckanext/googleauth/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 3b48ece..dcba788 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -163,6 +163,9 @@ def login(self): #if someone is logged in will be set the parameter c.user def identify(self): log.debug('identify()') + + log.debug('Pylons session... %r' % pylons.session) + user_ckan = pylons.session.get('ckanext-google-user') log.debug('CKAN User: %s' % user_ckan) if user_ckan: From a32d3f7e736cfdae8140888620ab2303256c424e Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 29 Mar 2023 23:42:56 +0100 Subject: [PATCH 20/26] Debug abort() --- ckanext/googleauth/plugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index dcba788..c5eee02 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -176,6 +176,10 @@ def logout(self): self._logout_user() def abort(self, status_code=None, detail='', headers=None, comment=None): + log.debug('abort() status_code=%s' % status_code) + + log.debug('Pylons session... %r' % pylons.session) + if status_code == 403 or status_code == 404: return (status_code, detail, headers, comment) self._logout_user() From 2b08851f4306a0a7d6644911d72fe9e6675d72cc Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Thu, 30 Mar 2023 10:11:42 +0100 Subject: [PATCH 21/26] More debugging --- ckanext/googleauth/plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index c5eee02..e8785bd 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -156,6 +156,8 @@ def login(self): log.debug('Session type: %s' % getattr(pylons.session, "type")) log.debug('Session dir: %s' % getattr(pylons.session, "data_dir")) + log.debug('Session id: %s' % getattr(pylons.session, "id")) + log.debug('Session namespace: %r' % getattr(pylons.session, "namespace")) log.debug('Redirecting to dashboard') h.redirect_to('/dashboard') @@ -167,7 +169,7 @@ def identify(self): log.debug('Pylons session... %r' % pylons.session) user_ckan = pylons.session.get('ckanext-google-user') - log.debug('CKAN User: %s' % user_ckan) + log.debug('CKAN User: %r' % user_ckan) if user_ckan: toolkit.c.user = user_ckan From 0460e12a96f7945c94262554355a8289164a34a4 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Thu, 30 Mar 2023 10:22:46 +0100 Subject: [PATCH 22/26] No attribute namespace --- ckanext/googleauth/plugin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index e8785bd..ceef36d 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -157,7 +157,6 @@ def login(self): log.debug('Session type: %s' % getattr(pylons.session, "type")) log.debug('Session dir: %s' % getattr(pylons.session, "data_dir")) log.debug('Session id: %s' % getattr(pylons.session, "id")) - log.debug('Session namespace: %r' % getattr(pylons.session, "namespace")) log.debug('Redirecting to dashboard') h.redirect_to('/dashboard') From 6d84f79e28c21fa7963002d21711c283eb56f84e Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Thu, 30 Mar 2023 10:38:36 +0100 Subject: [PATCH 23/26] More session debugging --- ckanext/googleauth/plugin.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index ceef36d..7b542ed 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -154,9 +154,11 @@ def login(self): log.debug('Saving pylons session... %r' % pylons.session) pylons.session.save() - log.debug('Session type: %s' % getattr(pylons.session, "type")) - log.debug('Session dir: %s' % getattr(pylons.session, "data_dir")) - log.debug('Session id: %s' % getattr(pylons.session, "id")) + log.debug('Session type: %s' % pylons.session.type) + log.debug('Session dir: %s' % pylons.session.data_dir) + log.debug('Session id: %s' % pylons.session.id) + log.debug('Session use_cookies: %s' % pylons.session.use_cookies) + log.debug('Session timeout: %s' % pylons.session.timeout) log.debug('Redirecting to dashboard') h.redirect_to('/dashboard') @@ -166,6 +168,11 @@ def identify(self): log.debug('identify()') log.debug('Pylons session... %r' % pylons.session) + log.debug('Session type: %s' % pylons.session.type) + log.debug('Session dir: %s' % pylons.session.data_dir) + log.debug('Session id: %s' % pylons.session.id) + log.debug('Session use_cookies: %s' % pylons.session.use_cookies) + log.debug('Session timeout: %s' % pylons.session.timeout) user_ckan = pylons.session.get('ckanext-google-user') log.debug('CKAN User: %r' % user_ckan) From 193c1de8b3097e7b48d7cf8e655017627a8a769d Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Tue, 4 Apr 2023 06:22:58 +0100 Subject: [PATCH 24/26] Try creating the session on GET --- ckanext/googleauth/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 7b542ed..6802c3d 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -116,6 +116,9 @@ def _logout_user(self): def login(self): log.debug('login()') + pylons.session['ckanext-google-foo'] = 'bar' + pylons.session.save() + params = toolkit.request.params if 'credential' in params: From b6bde01eb7abac1c2b921ba1229389095ce10959 Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Tue, 4 Apr 2023 07:04:15 +0100 Subject: [PATCH 25/26] Try deleting ckanext-google-foo --- ckanext/googleauth/plugin.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 6802c3d..70e52e7 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -108,6 +108,8 @@ def _logout_user(self): del pylons.session['ckanext-google-user'] if 'ckanext-google-email' in pylons.session: del pylons.session['ckanext-google-email'] + if 'ckanext-google-foo' in pylons.session: + del pylons.session['ckanext-google-foo'] pylons.session.save() From 31ea26bdb7c4eb1827d856e585800da5607d5e2f Mon Sep 17 00:00:00 2001 From: Martin Burchell Date: Wed, 5 Apr 2023 13:33:27 +0100 Subject: [PATCH 26/26] Remove workaround from previous commit --- ckanext/googleauth/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckanext/googleauth/plugin.py b/ckanext/googleauth/plugin.py index 70e52e7..3f1adbe 100644 --- a/ckanext/googleauth/plugin.py +++ b/ckanext/googleauth/plugin.py @@ -118,8 +118,8 @@ def _logout_user(self): def login(self): log.debug('login()') - pylons.session['ckanext-google-foo'] = 'bar' - pylons.session.save() + # pylons.session['ckanext-google-foo'] = 'bar' + # pylons.session.save() params = toolkit.request.params