Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #31 from mk-fg/configurable_scope_key

Made AccessRange.key length configurable
  • Loading branch information...
commit 8624f18e30b6a4ec59aa9ba9febd266b235603a4 2 parents 3c8c86d + 24e474a
@bhagany bhagany authored
Showing with 5 additions and 2 deletions.
  1. +3 −1 oauth2app/consts.py
  2. +2 −1  oauth2app/models.py
View
4 oauth2app/consts.py
@@ -12,6 +12,8 @@
CLIENT_KEY_LENGTH = getattr(settings, "OAUTH2_CLIENT_KEY_LENGTH", 30)
# Length of the client secret.
CLIENT_SECRET_LENGTH = getattr(settings, "OAUTH2_CLIENT_SECRET_LENGTH", 30)
+# Length of the scope key.
+SCOPE_LENGTH = getattr(settings, "OAUTH2_SCOPE_LENGTH", 255)
# Length of the code key.
CODE_KEY_LENGTH = getattr(settings, "OAUTH2_CODE_KEY_LENGTH", 30)
# Length of the MAC authentication key.
@@ -51,4 +53,4 @@
# Grants code style parameters.
CODE = 2
# Grants both style parameters.
-CODE_AND_TOKEN = CODE | TOKEN
+CODE_AND_TOKEN = CODE | TOKEN
View
3  oauth2app/models.py
@@ -10,6 +10,7 @@
from django.db import models
from django.contrib.auth.models import User
from .consts import CLIENT_KEY_LENGTH, CLIENT_SECRET_LENGTH
+from .consts import SCOPE_LENGTH
from .consts import ACCESS_TOKEN_LENGTH, REFRESH_TOKEN_LENGTH
from .consts import ACCESS_TOKEN_EXPIRATION, MAC_KEY_LENGTH, REFRESHABLE
from .consts import CODE_KEY_LENGTH, CODE_EXPIRATION
@@ -98,7 +99,7 @@ class AccessRange(models.Model):
*Default None*
"""
- key = models.CharField(unique=True, max_length=255, db_index=True)
+ key = models.CharField(unique=True, max_length=SCOPE_LENGTH, db_index=True)
description = models.TextField(blank=True)
Please sign in to comment.
Something went wrong with that request. Please try again.