python 3 compatibility
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
"""Third party authentication. """
|
||||
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from __future__ import absolute_import
|
||||
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
default_app_config = 'third_party_auth.apps.ThirdPartyAuthConfig'
|
||||
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
"""
|
||||
Admin site configuration for third party authentication
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from config_models.admin import KeyedConfigurationModelAdmin
|
||||
from django import forms
|
||||
from django.contrib import admin
|
||||
from django.urls import reverse
|
||||
from django.db import DatabaseError, transaction
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from openedx.core.djangolib.markup import HTML
|
||||
from third_party_auth.provider import Registry
|
||||
|
||||
from .models import (
|
||||
@@ -22,7 +25,6 @@ from .models import (
|
||||
SAMLProviderData
|
||||
)
|
||||
from .tasks import fetch_saml_metadata
|
||||
from openedx.core.djangolib.markup import HTML
|
||||
|
||||
|
||||
class OAuth2ProviderConfigForm(forms.ModelForm):
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
DummyBackend: A fake Third Party Auth provider for testing & development purposes.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from social_core.backends.oauth import BaseOAuth2
|
||||
from social_core.exceptions import AuthFailed
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Exceptions for SAML Authentication.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from social_core.exceptions import AuthException
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""Middleware classes for third_party_auth."""
|
||||
|
||||
import urlparse
|
||||
from __future__ import absolute_import
|
||||
|
||||
import six.moves.urllib.parse # pylint: disable=import-error
|
||||
from django.contrib import messages
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse
|
||||
@@ -39,7 +40,7 @@ class ExceptionMiddleware(SocialAuthExceptionMiddleware):
|
||||
referer_url = request.META.get('HTTP_REFERER', '')
|
||||
if (referer_url and isinstance(exception, HTTPError) and
|
||||
exception.response.status_code == 502):
|
||||
referer_url = urlparse.urlparse(referer_url).path
|
||||
referer_url = six.moves.urllib.parse.urlparse(referer_url).path
|
||||
if referer_url == reverse('signin_user'):
|
||||
messages.error(request, _('Unable to connect with the external provider, please try again'),
|
||||
extra_tags='social-auth')
|
||||
|
||||
@@ -10,6 +10,8 @@ If true, it:
|
||||
b) calls apply_settings(), passing in the Django settings
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from openedx.features.enterprise_support.api import insert_enterprise_pipeline_elements
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
Code to manage fetching and storing the metadata of IdPs.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import datetime
|
||||
import logging
|
||||
|
||||
@@ -16,8 +18,8 @@ from onelogin.saml2.utils import OneLogin_Saml2_Utils
|
||||
from requests import exceptions
|
||||
from six import text_type
|
||||
|
||||
from third_party_auth.models import SAMLConfiguration, SAMLProviderConfig, SAMLProviderData
|
||||
from openedx.core.djangolib.markup import Text
|
||||
from third_party_auth.models import SAMLConfiguration, SAMLProviderConfig, SAMLProviderData
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
"""Url configuration for the auth module."""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf.urls import include, url
|
||||
|
||||
from .views import (inactive_user_view, lti_login_and_complete_view,
|
||||
post_to_custom_auth_form, saml_metadata_view, IdPRedirectView)
|
||||
from .views import (
|
||||
IdPRedirectView,
|
||||
inactive_user_view,
|
||||
lti_login_and_complete_view,
|
||||
post_to_custom_auth_form,
|
||||
saml_metadata_view
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^auth/inactive', inactive_user_view, name="third_party_inactive_redirect"),
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Utility functions for third_party_auth
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user