1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

Merge pull request #420 from wwitzel3/release_3.2.0

Merge pull request #161 from wwitzel3/devel
This commit is contained in:
Wayne Witzel III 2017-09-18 09:54:54 -04:00 committed by GitHub
commit 540bda1d09
3 changed files with 33 additions and 1 deletions

View File

@ -497,7 +497,7 @@ else:
}
# Social Auth configuration.
SOCIAL_AUTH_STRATEGY = 'social.strategies.django_strategy.DjangoStrategy'
SOCIAL_AUTH_STRATEGY = 'awx.sso.strategies.django_strategy.AWXDjangoStrategy'
SOCIAL_AUTH_STORAGE = 'social.apps.django_app.default.models.DjangoStorage'
SOCIAL_AUTH_USER_MODEL = AUTH_USER_MODEL # noqa
SOCIAL_AUTH_PIPELINE = (

View File

@ -0,0 +1,2 @@
# Copyright (c) 2017 Ansible, Inc.
# All Rights Reserved.

View File

@ -0,0 +1,30 @@
# Copyright (c) 2017 Ansible, Inc.
# All Rights Reserved.
from social.strategies.django_strategy import DjangoStrategy
class AWXDjangoStrategy(DjangoStrategy):
"""A DjangoStrategy for python-social-auth containing
fixes and updates from social-app-django
TODO: Revert back to using the default DjangoStrategy after
we upgrade to social-core / social-app-django. We will also
want to ensure we update the SOCIAL_AUTH_STRATEGY setting.
"""
def __init__(self, storage, request=None, tpl=None):
super(AWXDjangoStrategy, self).__init__(storage, tpl)
def request_port(self):
"""Port in use for this request
https://github.com/python-social-auth/social-app-django/blob/master/social_django/strategy.py#L76
"""
try: # django >= 1.9
return self.request.get_port()
except AttributeError: # django < 1.9
host_parts = self.request.get_host().split(':')
try:
return host_parts[1]
except IndexError:
return self.request.META['SERVER_PORT']