INCR-234 (#20511)
* INCR-234: Run python-modernize and isort on openedx/core/djangoapps/oauth_dispatch * INCR-234: [ADD] Missing module docstring
This commit is contained in:
@@ -3,8 +3,9 @@ Adapter to isolate django-oauth2-provider dependencies
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from provider.oauth2 import models
|
||||
|
||||
from provider import constants, scope
|
||||
from provider.oauth2 import models
|
||||
|
||||
|
||||
class DOPAdapter(object):
|
||||
|
||||
@@ -3,6 +3,7 @@ Adapter to isolate django-oauth-toolkit dependencies
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from oauth2_provider import models
|
||||
|
||||
from openedx.core.djangoapps.oauth_dispatch.models import RestrictedApplication
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
Override admin configuration for django-oauth-toolkit
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib.admin import ModelAdmin, site
|
||||
from oauth2_provider import models
|
||||
|
||||
from .models import RestrictedApplication, ApplicationAccess, ApplicationOrganization
|
||||
from .models import ApplicationAccess, ApplicationOrganization, RestrictedApplication
|
||||
|
||||
|
||||
def reregister(model_class):
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
""" OAuth related Python apis. """
|
||||
from oauthlib.oauth2.rfc6749.tokens import BearerToken
|
||||
from __future__ import absolute_import
|
||||
|
||||
from oauth2_provider.models import AccessToken as dot_access_token
|
||||
from oauth2_provider.models import RefreshToken as dot_refresh_token
|
||||
from oauth2_provider.settings import oauth2_settings as dot_settings
|
||||
from oauthlib.oauth2.rfc6749.tokens import BearerToken
|
||||
from provider.oauth2.models import AccessToken as dop_access_token
|
||||
from provider.oauth2.models import RefreshToken as dop_refresh_token
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Custom authentication backends.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib.auth.backends import AllowAllUsersModelBackend as UserModelBackend
|
||||
from ratelimitbackend.backends import RateLimitMixin
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""
|
||||
Classes that override default django-oauth-toolkit behavior
|
||||
"""
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from django.contrib.auth import authenticate, get_user_model
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""
|
||||
Classes that override default django-oauth-toolkit behavior
|
||||
"""
|
||||
from __future__ import unicode_literals, absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from oauth2_provider.exceptions import OAuthToolkitError
|
||||
from oauth2_provider.http import HttpResponseUriRedirect
|
||||
from oauth2_provider.models import get_access_token_model, get_application_model
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
"""Utilities for working with ID tokens."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
from time import time
|
||||
|
||||
from django.conf import settings
|
||||
from edx_django_utils.monitoring import set_custom_metric
|
||||
from edx_rbac.utils import create_role_auth_claim_for_user
|
||||
from jwkest import jwk
|
||||
from jwkest.jws import JWS
|
||||
|
||||
from edx_rbac.utils import create_role_auth_claim_for_user
|
||||
|
||||
from edx_django_utils.monitoring import set_custom_metric
|
||||
from openedx.core.djangoapps.oauth_dispatch.toggles import ENFORCE_JWT_SCOPES
|
||||
from student.models import UserProfile, anonymous_id_for_user
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Management command for clear expired access tokens!
|
||||
"""
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import logging
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
"""
|
||||
Tests the ``edx_clear_expired_tokens`` management command.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
Specialized models for oauth_dispatch djangoapp
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import six
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django_mysql.models import ListCharField
|
||||
@@ -140,4 +143,4 @@ class ApplicationOrganization(models.Model):
|
||||
"""
|
||||
Serialize for use in JWT filter claim.
|
||||
"""
|
||||
return unicode(':'.join([self.relation_type, self.organization.short_name]))
|
||||
return six.text_type(':'.join([self.relation_type, self.organization.short_name]))
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Custom Django OAuth Toolkit scopes backends.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from oauth2_provider.scopes import SettingsScopes
|
||||
|
||||
from openedx.core.djangoapps.oauth_dispatch.models import ApplicationAccess
|
||||
@@ -19,5 +21,5 @@ class ApplicationModelScopes(SettingsScopes):
|
||||
application_scopes = []
|
||||
|
||||
default_scopes = self.get_default_scopes()
|
||||
all_scopes = self.get_all_scopes().keys()
|
||||
all_scopes = list(self.get_all_scopes().keys())
|
||||
return set(application_scopes + default_scopes).intersection(all_scopes)
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
Feature toggle code for oauth_dispatch.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from edx_rest_framework_extensions.config import SWITCH_ENFORCE_JWT_SCOPES
|
||||
|
||||
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace, WaffleSwitch
|
||||
from openedx.core.djangoapps.waffle_utils import WaffleSwitch, WaffleSwitchNamespace
|
||||
|
||||
WAFFLE_NAMESPACE = 'oauth2'
|
||||
OAUTH2_SWITCHES = WaffleSwitchNamespace(name=WAFFLE_NAMESPACE)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
OAuth2 wrapper urls
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
@@ -3,7 +3,7 @@ Views that dispatch processing of OAuth requests to django-oauth2-provider or
|
||||
django-oauth-toolkit as appropriate.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user