Alexis Metaireau avatar Alexis Metaireau committed ad2aaec

Add a way to configure the consumer tokens size via settings.py

Comments (0)

Files changed (4)

TODO

-Write documentation
-Write view tests
+django-oautclient
+=================
+
+* Write view tests

oauthclient/models.py

 from django.db import models
+from django.conf import settings
+from oauthclient.settings import OAUTH_CONSUMER_KEY_SIZE, OAUTH_CONSUMER_SECRET_SIZE
 import oauth2
 
-KEY_SIZE = SECRET_SIZE = 16
+KEY_SIZE = getattr(settings, 'OAUTH_CONSUMER_KEY_SIZE', 
+    OAUTH_CONSUMER_KEY_SIZE)
+SECRET_SIZE = getattr(settings,'OAUTH_CONSUMER_SECRET_SIZE', 
+    OAUTH_CONSUMER_SECRET_SIZE) 
 
 class OAuthServer(models.Model):
     """Defines the urls to use for the oauth authentication.

oauthclient/settings.py

+OAUTH_CONSUMER_KEY_SIZE = 18 
+OAUTH_CONSUMER_SECRET_SIZE = 32 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.