

def do_GET(self):
    ctx = self.ctx
    ctx['action'] = 'input parameters check'
    for (k, v) in self.get_params().items():
        ctx[k] = self.headers.get(v[0], v[1])
        if (ctx[k] == None):
            self.auth_failed(ctx, ('required "%s" header was not passed' % k))
            return True
    ctx['action'] = 'performing authorization'
    auth_header = self.headers.get('Authorization')
    auth_cookie = self.get_cookie(ctx['cookiename'])
    if ((auth_cookie != None) and (auth_cookie != '')):
        auth_header = ('Basic ' + auth_cookie)
        self.log_message(('using username/password from cookie %s' % ctx['cookiename']))
    else:
        self.log_message('using username/password from authorization header')
    if ((auth_header is None) or (not auth_header.lower().startswith('basic '))):
        self.send_response(401)
        self.send_header('WWW-Authenticate', ('Basic realm=' + ctx['realm']))
        self.send_header('Cache-Control', 'no-cache')
        self.end_headers()
        return True
    ctx['action'] = 'decoding credentials'
    try:
        auth_decoded = base64.b64decode(auth_header[6:])
        (user, passwd) = auth_decoded.split(':', 2)
    except:
        self.auth_failed(ctx)
        return True
    ctx['user'] = user
    ctx['pass'] = passwd
    return False

dataset/ETHPy150Open nginxinc/nginx-ldap-auth/nginx-ldap-auth-daemon.py AuthHandler.do_GET/original