From f92c725113d5e1a23e7a1cc92186cd015358f276 Mon Sep 17 00:00:00 2001 From: Evan Culver Date: Fri, 25 Oct 2013 15:21:34 -0700 Subject: [PATCH] Clean up and PEP8 for #41. --- provider/oauth2/backends.py | 23 ++--------------------- provider/oauth2/forms.py | 6 +----- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/provider/oauth2/backends.py b/provider/oauth2/backends.py index 5c0e39f..db0fb85 100644 --- a/provider/oauth2/backends.py +++ b/provider/oauth2/backends.py @@ -1,8 +1,6 @@ -from django.contrib.auth import authenticate - from ..utils import now from .forms import ClientAuthForm, PublicPasswordGrantForm -from .models import AccessToken, Client +from .models import AccessToken class BaseBackend(object): @@ -63,25 +61,9 @@ class RequestParamsClientBackend(object): return None -class RequestParamsClientBackend(object): - """ - Backend that tries to authenticate a client through request parameters - which might be in the request body or URI as defined in :rfc:`2.3.1`. - """ - def authenticate(self, request=None): - if request is None: - return None - - form = ClientAuthForm(request.REQUEST) - - if form.is_valid(): - return form.cleaned_data.get('client') - - return None - class PublicPasswordBackend(object): """ - Backend that tries to authenticate a client using username, password + Backend that tries to authenticate a client using username, password and client ID. This is only available in specific circumstances: - grant_type is "password" @@ -100,7 +82,6 @@ class PublicPasswordBackend(object): return None - class AccessTokenBackend(object): """ Authenticate a user via access token and client object. diff --git a/provider/oauth2/forms.py b/provider/oauth2/forms.py index 32ce019..b5d04c3 100644 --- a/provider/oauth2/forms.py +++ b/provider/oauth2/forms.py @@ -302,6 +302,7 @@ class PasswordGrantForm(ScopeMixin, OAuthForm): data['user'] = user return data + class PublicPasswordGrantForm(PasswordGrantForm): client_id = forms.CharField(required=True) grant_type = forms.CharField(required=True) @@ -327,8 +328,3 @@ class PublicPasswordGrantForm(PasswordGrantForm): data['client'] = client return data - - - - -