mirror of
https://github.com/quantum5/nginx-krbauth.git
synced 2025-04-24 12:32:03 -04:00
Make cookie a string
This commit is contained in:
parent
ae6fd65981
commit
2769dfd5f8
|
@ -56,10 +56,10 @@ class Context:
|
||||||
return ''.join([self.ldap_group]).encode('utf-8')
|
return ''.join([self.ldap_group]).encode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
def make_cookie(context: Context) -> bytes:
|
def make_cookie(context: Context) -> str:
|
||||||
message = timestamp.pack(int(time.time()) + DURATION) + os.urandom(RANDOM_SIZE) + context.bytes()
|
message = timestamp.pack(int(time.time()) + DURATION) + os.urandom(RANDOM_SIZE) + context.bytes()
|
||||||
signature = hmac.new(HMAC_KEY, message, hmac_digest).digest()
|
signature = hmac.new(HMAC_KEY, message, hmac_digest).digest()
|
||||||
return base64.b64encode(signature + message)
|
return base64.b64encode(signature + message).decode()
|
||||||
|
|
||||||
|
|
||||||
def verify_cookie(cookie: Optional[str], context: Context) -> bool:
|
def verify_cookie(cookie: Optional[str], context: Context) -> bool:
|
||||||
|
|
Loading…
Reference in a new issue