Commit 201a596c authored by Jérome Perrin's avatar Jérome Perrin

access_token: use os.urandom to generate token

Using same method as python 3.6's secrets module and a bit longer token
that what python currently recommends, since we were using very very
long tokens until now (so that it does not look like a "regression")
parent 758fc366
alpha = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' import os
random_id = '' import base64
for _ in range(0, 128):
random_id += random.choice(alpha) # This is python 3.6 secret.token_urlsafe
random_id = base64.urlsafe_b64encode(os.urandom(48)).rstrip(b'=').decode('ascii')
# Define Reference from ID provided by portal_ids # Define Reference from ID provided by portal_ids
portal = context.getPortalObject() portal = context.getPortalObject()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment