2 from BaseHTTPServer
import BaseHTTPRequestHandler, HTTPServer
8 session_key = os.path.basename(self.path)
9 file =
'/tmp/openvpn_sso_' + session_key
10 print 'session file: ' + file
14 self.send_response(200)
16 self.send_header(
'Content-type',
'text-html')
19 user = f.read().rstrip()
20 print 'session user: ' + user
21 print 'session key: ' + session_key
22 self.wfile.
write(
'<html><body><h1>Greetings ' + user \
23 +
'. You are authorized' \
29 self.send_error(404,
'authentication failed')
34 server_address = (
'0.0.0.0', 8080)
35 httpd = HTTPServer(server_address, ExampleHTTPRequestHandler)
36 print(
'http server started')
38 print(
'http server stopped')
40 if __name__ ==
'__main__':