First pass at implementing API authentication using new JWT tokens

- NOTE - this does not manage secrets. There is only one URL and there is no functionality implemented
- prior to rolling out we need to store secrets properly

Uses the JWT libraries in [https://github.com/alphagov/notifications-python-client](https://github.com/alphagov/notifications-python-client)

- Tokens are checked on every request and will be rejected if token is invalid as per the rules in the python clients.
This commit is contained in:
Martyn Inglis
2015-12-15 10:47:20 +00:00
parent 6a3bbbf890
commit dbf70ec1eb
6 changed files with 190 additions and 172 deletions

View File

@@ -1,9 +1,12 @@
import os
from flask._compat import string_types
from flask import Flask
from flask import Flask, _request_ctx_stack
from werkzeug.local import LocalProxy
from config import configs
api_user = LocalProxy(lambda: _request_ctx_stack.top.api_user)
def create_app(config_name):
application = Flask(__name__)