From 7fba45e625ad8df8765a505178390ca7671a3d0d Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 22 May 2014 18:08:51 +0200 Subject: [PATCH] allauth_authentic2: add an ALLAUTH_A2_VERIFY settings Define SETTING_ALLAUTH_A2_VERIFY=0 to deactivate verification of SSL certificate when contacting an OAuth2 identity provider. --- portail_citoyen2/allauth_authentic2/app_settings.py | 1 + portail_citoyen2/allauth_authentic2/views.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/portail_citoyen2/allauth_authentic2/app_settings.py b/portail_citoyen2/allauth_authentic2/app_settings.py index 6ebbc07..adaf514 100644 --- a/portail_citoyen2/allauth_authentic2/app_settings.py +++ b/portail_citoyen2/allauth_authentic2/app_settings.py @@ -3,6 +3,7 @@ import sys class AppSettings(object): __defaults = { 'ADMIN_ROLE': None, + 'VERIFY': True, } def __init__(self, prefix): diff --git a/portail_citoyen2/allauth_authentic2/views.py b/portail_citoyen2/allauth_authentic2/views.py index d5de16a..0d177d1 100644 --- a/portail_citoyen2/allauth_authentic2/views.py +++ b/portail_citoyen2/allauth_authentic2/views.py @@ -8,6 +8,7 @@ from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter, OAuth2LoginView, OAuth2CallbackView) from .provider import Authentic2Provider +from . import app_settings log = logging.getLogger(__name__) @@ -35,7 +36,8 @@ class Authentic2OAuth2Adapter(OAuth2Adapter): def complete_login(self, request, app, token, **kwargs): resp = requests.get(self.profile_url, - headers={'authorization': 'Bearer %s' % token.token}) + headers={'authorization': 'Bearer %s' % token.token}, + verify=app_settings.VERIFY) extra_data = resp.json() log.debug('received profile data: %r', extra_data) return self.get_provider().sociallogin_from_response(request,