summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Culver <evan@evanculver.com>2013-10-25 22:21:34 (GMT)
committerEvan Culver <evan@evanculver.com>2013-10-25 22:23:50 (GMT)
commitf92c725113d5e1a23e7a1cc92186cd015358f276 (patch)
tree840dd98cf387447d337bb1616a5876912293f91c
parent69a7c3e2e309dc917f6dbdef437ca2d72f7af450 (diff)
downloaddjango-oauth2-provider-f92c725113d5e1a23e7a1cc92186cd015358f276.zip
django-oauth2-provider-f92c725113d5e1a23e7a1cc92186cd015358f276.tar.gz
django-oauth2-provider-f92c725113d5e1a23e7a1cc92186cd015358f276.tar.bz2
Clean up and PEP8 for #41.
-rw-r--r--provider/oauth2/backends.py23
-rw-r--r--provider/oauth2/forms.py6
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
-
-
-
-
-