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.
This commit is contained in:
parent
423943e76c
commit
7fba45e625
|
@ -3,6 +3,7 @@ import sys
|
|||
class AppSettings(object):
|
||||
__defaults = {
|
||||
'ADMIN_ROLE': None,
|
||||
'VERIFY': True,
|
||||
}
|
||||
|
||||
def __init__(self, prefix):
|
||||
|
|
|
@ -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,
|
||||
|
|
Reference in New Issue