Skip to content

Commit 42fa7ba

Browse files
committed
py3 fixes
1 parent 9b9ad96 commit 42fa7ba

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

root/app/ldap-backend-app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def do_POST(self):
136136

137137
cipher_suite = Fernet(REPLACEWITHFERNETKEY)
138138
enc = cipher_suite.encrypt(ensure_bytes(user + ':' + passwd))
139-
self.send_header('Set-Cookie', b'nginxauth=' + enc + b'; httponly')
139+
self.send_header('Set-Cookie', 'nginxauth=' + enc + '; httponly')
140140

141141
self.send_header('Location', target)
142142
self.end_headers()

root/app/nginx-ldap-auth-daemon.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,12 @@ def do_GET(self):
8888
cipher_suite = Fernet(REPLACEWITHFERNETKEY)
8989
self.log_message('Trying to dechipher credentials...')
9090
auth_decoded = cipher_suite.decrypt(auth_header[6:])
91+
auth_decoded = auth_decoded.decode("utf-8")
9192
user, passwd = auth_decoded.split(':', 1)
9293
except InvalidToken:
9394
self.log_message('Incorrect token. Trying to decode credentials from BASE64...')
9495
auth_decoded = base64.b64decode(auth_header[6:])
95-
if sys.version_info.major == 3: auth_decoded = auth_decoded.decode("utf-8")
96+
auth_decoded = auth_decoded.decode("utf-8")
9697
user, passwd = auth_decoded.split(':', 1)
9798
except Exception as e:
9899
self.auth_failed(ctx)

0 commit comments

Comments
 (0)