OAuth Provider Rewrite (#182)
This commit is contained in:
17
passbook/providers/oauth2/generators.py
Normal file
17
passbook/providers/oauth2/generators.py
Normal file
@ -0,0 +1,17 @@
|
||||
"""OAuth2 Client ID/Secret Generators"""
|
||||
import string
|
||||
from random import SystemRandom
|
||||
|
||||
|
||||
def generate_client_id():
|
||||
"""Generate a random client ID"""
|
||||
rand = SystemRandom()
|
||||
return "".join(rand.choice(string.ascii_letters + string.digits) for x in range(40))
|
||||
|
||||
|
||||
def generate_client_secret():
|
||||
"""Generate a suitable client secret"""
|
||||
rand = SystemRandom()
|
||||
return "".join(
|
||||
rand.choice(string.ascii_letters + string.digits) for x in range(128)
|
||||
)
|
||||
Reference in New Issue
Block a user