From 853b82126baa1e8e408a10f91053c52626ffad29 Mon Sep 17 00:00:00 2001 From: hc Date: Wed, 20 Nov 2024 12:51:33 +0800 Subject: working --- flask1.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 flask1.py (limited to 'flask1.py') 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/', methods=['GET']) +def authenticate(code): + if store.authenticate(code): + return "True" + else: + return "False" + +@app.route('/v/', 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) -- cgit v1.2.3-70-g09d2