From 2769dfd5f84fe1b5ed5e178e29edc0ec61f8d628 Mon Sep 17 00:00:00 2001 From: Quantum Date: Thu, 21 Dec 2023 03:25:50 -0500 Subject: [PATCH] Make cookie a string --- nginx_krbauth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx_krbauth.py b/nginx_krbauth.py index a4449f3..232e18f 100644 --- a/nginx_krbauth.py +++ b/nginx_krbauth.py @@ -56,10 +56,10 @@ class Context: 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() 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: