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 = { 'IGNORED_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.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f110b3b4ac67037f682a7d0a9a2260fda5706ea752a7bc5a4809c46b3495329 |
|
MD5 | 81449db35a891c485677de5a9ced73cd |
|
BLAKE2b-256 | 9d2f88d5fe75677de0842034310cf7531cfc48e5e13fd16443ec697c504a6002 |
Hashes for jsa_auth_middleware-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dadc5bb33b5aeb90e2c72d2dcdf352102ad9842aee739ff517412e57628a8563 |
|
MD5 | 0927320a1d93ef9fa39485884ef32931 |
|
BLAKE2b-256 | c2f5198d16362cb7f3e7f050f76b1fc471ea6bdcdf13c9c857d3553e210e44a8 |