Merge b654376e2a into c98eb555f5
This commit is contained in:
commit
86a49391f5
|
|
@ -68,7 +68,8 @@ class AuthHandler(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
ctx['action'] = 'performing authorization'
|
ctx['action'] = 'performing authorization'
|
||||||
auth_header = self.headers.get('Authorization')
|
auth_header = self.headers.get('Authorization')
|
||||||
auth_cookie = self.get_cookie(ctx['cookiename'])
|
cookiename = ctx['cookiename']
|
||||||
|
auth_cookie = self.get_cookie(cookiename)
|
||||||
|
|
||||||
if auth_cookie != None and auth_cookie != '':
|
if auth_cookie != None and auth_cookie != '':
|
||||||
auth_header = "Basic " + auth_cookie
|
auth_header = "Basic " + auth_cookie
|
||||||
|
|
@ -89,6 +90,9 @@ class AuthHandler(BaseHTTPRequestHandler):
|
||||||
ctx['action'] = 'decoding credentials'
|
ctx['action'] = 'decoding credentials'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if cookiename != None and cookiename != '':
|
||||||
|
ctx['cookievalue'] = auth_header[6:]
|
||||||
|
|
||||||
auth_decoded = base64.b64decode(auth_header[6:])
|
auth_decoded = base64.b64decode(auth_header[6:])
|
||||||
if sys.version_info.major == 3: auth_decoded = auth_decoded.decode("utf-8")
|
if sys.version_info.major == 3: auth_decoded = auth_decoded.decode("utf-8")
|
||||||
user, passwd = auth_decoded.split(':', 1)
|
user, passwd = auth_decoded.split(':', 1)
|
||||||
|
|
@ -274,6 +278,10 @@ class LDAPAuthHandler(AuthHandler):
|
||||||
|
|
||||||
# Successfully authenticated user
|
# Successfully authenticated user
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
|
cookievalue = ctx['cookievalue']
|
||||||
|
if cookievalue != None:
|
||||||
|
# Cookie.SimpleCookie() causes issues with double quotes
|
||||||
|
self.send_header("Set-Cookie", "%s=%s" % (ctx['cookiename'], cookievalue))
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue