summaryrefslogtreecommitdiff
path: root/flask1.py
diff options
context:
space:
mode:
Diffstat (limited to 'flask1.py')
-rw-r--r--flask1.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/flask1.py b/flask1.py
new file mode 100644
index 0000000..eb9ff28
--- /dev/null
+++ b/flask1.py
@@ -0,0 +1,38 @@
+from flask import Flask
+from flask import Flask, request, jsonify
+from tfa import *
+
+app = Flask(__name__)
+store = customstore()
+
+@app.route('/')
+def hello_world():
+ return """Hello, World!
+This is an authentication server
+Available directories are:
+/c to create a key
+/a to authorise a key
+/v to verify that a key is authorised
+
+"""
+
+@app.route('/c', methods=['GET'])
+def create():
+ return store.create()
+
+@app.route('/a/<code>', methods=['GET'])
+def authenticate(code):
+ if store.authenticate(code):
+ return "True"
+ else:
+ return "False"
+
+@app.route('/v/<code>', methods=['GET'])
+def verify(code):
+ if store.check(code):
+ return "True"
+ else:
+ return "False"
+
+if __name__ == '__main__':
+ app.run(host='0.0.0.0', port=5000, debug=True)