Skip to content

Commit 7ad5e00

Browse files
committed
Change default generator for client_id and client_secret: now use a safe set of characters that don't need escaping. That way we should avoid problems with many dummy client implementations
1 parent 7b03cdf commit 7ad5e00

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

oauth2_provider/generators.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
from oauthlib.common import CLIENT_ID_CHARACTER_SET, generate_client_id as oauthlib_generate_client_id
1+
from oauthlib.common import generate_client_id as oauthlib_generate_client_id
22

33
from .settings import oauth2_settings
44

55

6+
CLIENT_ID_CHARACTER_SET = r'_-.:;=?!@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
7+
8+
69
class BaseHashGenerator(object):
710
"""
811
All generators should extend this class overriding `.hash()` method.
@@ -23,7 +26,7 @@ def hash(self):
2326

2427
class ClientSecretGenerator(BaseHashGenerator):
2528
def hash(self):
26-
return oauthlib_generate_client_id(length=128)
29+
return oauthlib_generate_client_id(length=128, chars=CLIENT_ID_CHARACTER_SET)
2730

2831

2932
def generate_client_id():

0 commit comments

Comments
 (0)