Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 7, 2025
1 parent 87bbf79 commit 85991ac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions oauth2_provider/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,12 @@ def get_application_model():
"""Return the Application model that is active in this project."""
return apps.get_model(oauth2_settings.APPLICATION_MODEL)


def get_device_model():
"""Return the Device model that is active in this project."""
return apps.get_model(oauth2_settings.DEVICE_MODEL)


def get_device_model():
"""Return the Device model that is active in this project."""
return apps.get_model(oauth2_settings.DEVICE_MODEL)
Expand Down
2 changes: 1 addition & 1 deletion oauth2_provider/oauth2_backends.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 4 additions & 3 deletions oauth2_provider/oauth2_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion oauth2_provider/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]


Expand Down

0 comments on commit 85991ac

Please sign in to comment.