From: Matías Aguirre Date: Wed, 16 Feb 2011 01:08:12 +0000 (-0200) Subject: Make AUTH_BACKEND a mandatory attribute X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=e20e35f407e0ecf22e553c14dacc112ed806fc01;p=django-social-auth.git Make AUTH_BACKEND a mandatory attribute --- 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"""