From d94410c3ee0185d2fa984d2ee50c33970b513494 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 16:07:19 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- oauth2_provider/oauth2_backends.py | 2 +- oauth2_provider/oauth2_validators.py | 7 ++++--- oauth2_provider/urls.py | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/oauth2_provider/oauth2_backends.py b/oauth2_provider/oauth2_backends.py index f04463d2d..accd9d3f8 100644 --- a/oauth2_provider/oauth2_backends.py +++ b/oauth2_provider/oauth2_backends.py @@ -1,11 +1,11 @@ import json from urllib.parse import urlparse, urlunparse +from django.http import HttpRequest from oauthlib import oauth2 from oauthlib.common import Request as OauthlibRequest from oauthlib.common import quote, urlencode, urlencoded from oauthlib.oauth2 import OAuth2Error -from django.http import HttpRequest from .exceptions import FatalClientError, OAuthToolkitError from .settings import oauth2_settings diff --git a/oauth2_provider/oauth2_validators.py b/oauth2_provider/oauth2_validators.py index 7e7c36e91..9bb94c0ad 100644 --- a/oauth2_provider/oauth2_validators.py +++ b/oauth2_provider/oauth2_validators.py @@ -56,7 +56,7 @@ AbstractApplication.GRANT_CLIENT_CREDENTIALS, AbstractApplication.GRANT_OPENID_HYBRID, ), - "urn:ietf:params:oauth:grant-type:device_code": (AbstractApplication.GRANT_DEVICE_CODE,) + "urn:ietf:params:oauth:grant-type:device_code": (AbstractApplication.GRANT_DEVICE_CODE,), } Application = get_application_model() @@ -167,8 +167,9 @@ def _authenticate_basic_auth(self, request): elif request.client.client_id != client_id: log.debug("Failed basic auth: wrong client id %s" % client_id) return False - elif (request.client.client_type == "public" - and request.grant_type == "urn:ietf:params:oauth:grant-type:device_code" + elif ( + request.client.client_type == "public" + and request.grant_type == "urn:ietf:params:oauth:grant-type:device_code" ): return True elif not self._check_secret(client_secret, request.client.client_secret): diff --git a/oauth2_provider/urls.py b/oauth2_provider/urls.py index 5bc9586b6..e7dfe8488 100644 --- a/oauth2_provider/urls.py +++ b/oauth2_provider/urls.py @@ -11,7 +11,7 @@ path("token/", views.TokenView.as_view(), name="token"), path("revoke_token/", views.RevokeTokenView.as_view(), name="revoke-token"), path("introspect/", views.IntrospectTokenView.as_view(), name="introspect"), - path("device_authorization/", views.DeviceAuthorizationView.as_view(), name="device-authorization") + path("device_authorization/", views.DeviceAuthorizationView.as_view(), name="device-authorization"), ]