mirror of https://github.com/sipwise/sems.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
500 B
25 lines
500 B
import SimpleXMLRPCServer
|
|
|
|
#The server object
|
|
class AuthServer:
|
|
def __init__(self):
|
|
self.keys = {}
|
|
|
|
def authorize(self, room, pin):
|
|
if self.keys.has_key(room):
|
|
if self.keys[room] == pin:
|
|
return 'OK'
|
|
else:
|
|
return 'FAIL'
|
|
else:
|
|
self.keys[room] = pin
|
|
return 'OK'
|
|
|
|
authsrv = AuthServer()
|
|
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("127.0.0.1", 9090))
|
|
server.register_instance(authsrv)
|
|
|
|
#Go into the main listener loop
|
|
print "Listening on port 9090"
|
|
server.serve_forever()
|