@@ -1,6 +1,8 @@
|
|||||||
"""
|
"""
|
||||||
Third party auth API related permissions
|
Third party auth API related permissions
|
||||||
"""
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from rest_framework import permissions
|
from rest_framework import permissions
|
||||||
|
|
||||||
from third_party_auth.models import ProviderApiPermissions
|
from third_party_auth.models import ProviderApiPermissions
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
""" Django REST Framework Serializers """
|
""" Django REST Framework Serializers """
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
"""
|
"""
|
||||||
Tests for the Third Party Auth permissions
|
Tests for the Third Party Auth permissions
|
||||||
"""
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
from mock import Mock
|
|
||||||
|
|
||||||
from rest_framework.test import APITestCase
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from third_party_auth.api.permissions import ThirdPartyAuthProviderApiPermission
|
from mock import Mock
|
||||||
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
|
from third_party_auth.api.permissions import ThirdPartyAuthProviderApiPermission
|
||||||
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin
|
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin
|
||||||
|
|
||||||
IDP_SLUG_TESTSHIB = 'testshib'
|
IDP_SLUG_TESTSHIB = 'testshib'
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
"""
|
"""
|
||||||
Tests for the Third Party Auth REST API
|
Tests for the Third Party Auth REST API
|
||||||
"""
|
"""
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
@@ -11,17 +13,17 @@ from django.test.utils import override_settings
|
|||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from mock import patch
|
from mock import patch
|
||||||
from provider.constants import CONFIDENTIAL
|
from provider.constants import CONFIDENTIAL
|
||||||
from provider.oauth2.models import Client, AccessToken
|
from provider.oauth2.models import AccessToken, Client
|
||||||
from openedx.core.lib.api.permissions import ApiKeyHeaderPermission
|
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
from six.moves import range
|
||||||
from social_django.models import UserSocialAuth
|
from social_django.models import UserSocialAuth
|
||||||
|
|
||||||
|
from openedx.core.lib.api.permissions import ApiKeyHeaderPermission
|
||||||
from student.tests.factories import UserFactory
|
from student.tests.factories import UserFactory
|
||||||
from third_party_auth.api.permissions import ThirdPartyAuthProviderApiPermission
|
from third_party_auth.api.permissions import ThirdPartyAuthProviderApiPermission
|
||||||
from third_party_auth.models import ProviderApiPermissions
|
from third_party_auth.models import ProviderApiPermissions
|
||||||
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin
|
from third_party_auth.tests.testutil import ThirdPartyAuthTestMixin
|
||||||
|
|
||||||
|
|
||||||
VALID_API_KEY = "i am a key"
|
VALID_API_KEY = "i am a key"
|
||||||
IDP_SLUG_TESTSHIB = 'testshib'
|
IDP_SLUG_TESTSHIB = 'testshib'
|
||||||
PROVIDER_ID_TESTSHIB = 'saml-' + IDP_SLUG_TESTSHIB
|
PROVIDER_ID_TESTSHIB = 'saml-' + IDP_SLUG_TESTSHIB
|
||||||
@@ -201,7 +203,7 @@ class UserViewAPITests(UserViewsMixin, TpaAPITestCase):
|
|||||||
"""
|
"""
|
||||||
return reverse(
|
return reverse(
|
||||||
'third_party_auth_users_api',
|
'third_party_auth_users_api',
|
||||||
kwargs={'username': identifier.values()[0]}
|
kwargs={'username': list(identifier.values())[0]}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
""" URL configuration for the third party auth API """
|
""" URL configuration for the third party auth API """
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from .views import ThirdPartyAuthUserStatusView, UserMappingView, UserView, UserViewV2
|
from .views import ThirdPartyAuthUserStatusView, UserMappingView, UserView, UserViewV2
|
||||||
|
|
||||||
|
|
||||||
PROVIDER_PATTERN = r'(?P<provider_id>[\w.+-]+)(?:\:(?P<idp_slug>[\w.+-]+))?'
|
PROVIDER_PATTERN = r'(?P<provider_id>[\w.+-]+)(?:\:(?P<idp_slug>[\w.+-]+))?'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
Third Party Auth REST API views
|
Third Party Auth REST API views
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|||||||
@@ -2,8 +2,12 @@
|
|||||||
"""
|
"""
|
||||||
Management commands for third_party_auth
|
Management commands for third_party_auth
|
||||||
"""
|
"""
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
|
||||||
from third_party_auth.tasks import fetch_saml_metadata
|
from third_party_auth.tasks import fetch_saml_metadata
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user