From e20e35f407e0ecf22e553c14dacc112ed806fc01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C3=ADas=20Aguirre?= Date: Tue, 15 Feb 2011 23:08:12 -0200 Subject: [PATCH] Make AUTH_BACKEND a mandatory attribute --- social_auth/backends/__init__.py | 15 +++++++-------- social_auth/backends/facebook.py | 2 ++ social_auth/backends/google.py | 1 - 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/social_auth/backends/__init__.py b/social_auth/backends/__init__.py index 2e52313..0e5e31a 100644 --- a/social_auth/backends/__init__.py +++ b/social_auth/backends/__init__.py @@ -260,7 +260,12 @@ class OpenIDBackend(SocialAuthBackend): class BaseAuth(object): """Base authentication class, new authenticators should subclass - and implement needed methods""" + and implement needed methods. + + @AUTH_BACKEND Authorization backend related with this service + """ + AUTH_BACKEND = None + def __init__(self, request, redirect): self.request = request self.data = request.POST if request.method == 'POST' else request.GET @@ -297,10 +302,7 @@ class BaseAuth(object): class OpenIdAuth(BaseAuth): - """ - OpenId process handling - @AUTH_BACKEND Authorization backend related with this service - """ + """OpenId process handling""" AUTH_BACKEND = OpenIDBackend def auth_url(self): @@ -406,14 +408,11 @@ class ConsumerBasedOAuth(BaseOAuth): @REQUEST_TOKEN_URL Request token URL @ACCESS_TOKEN_URL Access token URL @SERVER_URL Authorization server URL - @AUTH_BACKEND Authorization backend related with - this service """ AUTHORIZATION_URL = '' REQUEST_TOKEN_URL = '' ACCESS_TOKEN_URL = '' SERVER_URL = '' - AUTH_BACKEND = None SETTINGS_KEY_NAME = '' SETTINGS_SECRET_NAME = '' diff --git a/social_auth/backends/facebook.py b/social_auth/backends/facebook.py index b397b57..6ed3752 100644 --- a/social_auth/backends/facebook.py +++ b/social_auth/backends/facebook.py @@ -40,6 +40,8 @@ class FacebookBackend(OAuthBackend): class FacebookAuth(BaseOAuth): """Facebook OAuth mechanism""" + AUTH_BACKEND = FacebookBackend + def auth_url(self): """Returns redirect url""" args = {'client_id': settings.FACEBOOK_APP_ID, diff --git a/social_auth/backends/google.py b/social_auth/backends/google.py index ac4a1df..292ff36 100644 --- a/social_auth/backends/google.py +++ b/social_auth/backends/google.py @@ -71,7 +71,6 @@ class BaseGoogleOAuth(ConsumerBasedOAuth): REQUEST_TOKEN_URL = GOOGLE_REQUEST_TOKEN_URL ACCESS_TOKEN_URL = GOOGLE_ACCESS_TOKEN_URL SERVER_URL = GOOGLE_SERVER - AUTH_BACKEND = None def user_data(self, access_token): """Loads user data from G service""" -- 2.39.5