mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
sso: Update usage of OpenSSL crypt signing API
Avoid the deprecation warning:
DeprecationWarning: str for data is no longer accepted, use bytes
sig = crypto.sign(pkey, data, 'sha512')
Tests:
- Login to web interface, access Syncthing web interface. The login should work.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
07e62a213b
commit
a0d880b62c
@ -74,8 +74,8 @@ def create_ticket(pkey, uid, validuntil, ip=None, tokens=None, udata=None,
|
||||
tokens and f'tokens={tokens}',
|
||||
graceperiod and f'graceperiod={int(graceperiod)}',
|
||||
udata and f'udata={udata}',
|
||||
extra_fields and ';'.join(
|
||||
['{}={}'.format(k, v) for k, v in extra_fields])
|
||||
extra_fields
|
||||
and ';'.join(['{}={}'.format(k, v) for k, v in extra_fields]),
|
||||
]
|
||||
data = ';'.join(filter(None, fields))
|
||||
signature = 'sig={}'.format(sign(pkey, data))
|
||||
@ -84,7 +84,7 @@ def create_ticket(pkey, uid, validuntil, ip=None, tokens=None, udata=None,
|
||||
|
||||
def sign(pkey, data):
|
||||
"""Calculates and returns ticket's signature."""
|
||||
sig = crypto.sign(pkey, data, 'sha512')
|
||||
sig = crypto.sign(pkey, data.encode(), 'sha512')
|
||||
return base64.b64encode(sig).decode()
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user