JetStream Authentication MiddleWare
Project description
JSA Auth Middleware is a python package built for integrating with JetStream across multiple micro-services, with the aim of handling authentication and Single-Sign-On while ensuring API security.
Quick start
Configure AUTH_BASE_URL in project settings pointing to the Authentication server without trailing slash
Add jsa_auth_middleware.JSAMiddleware to your MIDDLEWARE configuration in settings.py to validate authentication of all incoming requests. Maintain the order and hierarchy of middlewares, with Django middlewares above JSAMiddleware.
MIDDLEWARE = [ ... 'jsa_auth_middleware.JSAMiddleware', ]
Setup JSAMiddleware configuration in settings.py:
JSA_AUTH_MIDDLEWARE_CONFIG = { 'IGNORE_URLS': ( '<<URL_TO_IGNORE>>', ), 'IGNORE_STARTSWITH_URLS': ( '<<URL_TO_IGNORE>>', ), 'AUTH_BASE_URL': '', # optional if variable isn't in `settings.py` }
Import Query Response across application to define and process API response:
from jsa_auth_middleware.query_response import Response resp = Response() resp.failed() # on failure, using default failure status_code resp.message = '<<Some response message>>' resp.add_params('<<data_key>>', <<data_value>>) resp = Response() resp.passed() # on success, using default success status_code resp.message = '<<Some response message>>' resp.add_params('<<data_key>>', <<data_value>>) # Setting response status code resp.status_code = <<CustomStatusCode>>
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for jsa-auth-middleware-0.0.3.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26b6c11f91cf8d9008c6a5acaa5697317f0d8e5fa6adff0204b85a7ec6869462 |
|
MD5 | f5f86e7e0e7028040a8a7d2e26cc2f40 |
|
BLAKE2b-256 | c718668f08dd4a207f79f636e4a61fc9f16ac4505150e8855cc6c74ded0c11d6 |
Hashes for jsa_auth_middleware-0.0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba28663962f88b046e049e7973c732ed2ea7019c1885718f0404b314e9fa2577 |
|
MD5 | 461d8408d10b5f04203628e4accaddc7 |
|
BLAKE2b-256 | ba369ce3e0762cb5c5d445b17c840223d8812cc6d2db43e17aceb373672e4742 |