Some private battery for FastAPI.
Project description
#Initialization
login = SPYCLogin() login.init_app(app)
OR
SPYCLogin(app)
#Set login_handler
@SPYCLogin.session_controller def set_user(identity=None): if not identity: email = 'visitor@unknown.com' role = 'public' if identity: email = identity['email'] role = identity['role'] session['email'] = email session['role'] = role session['login'] = email.endswith('@school.pyc.edu.hk')
#Login Usage
https://localhost/login?redirect=https://frontend.com
#Required Env
SPYC_LOGIN_URL = XXXXX
Remarks
- Must have index endpoint for default redirect
- session_controller must define session['login'] = boolean
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
FastAPI-battery-0.0.0.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for FastAPI_battery-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d97f7a163ef76a13fa42c5a9d89fb3b480556cf4293cd281258ba9be6686aab5 |
|
MD5 | e7fb90663120409f3b758aeb8f5c3730 |
|
BLAKE2b-256 | 856ab36f71444136191e224f305486c80646aa801b705af5628cbe24cb92dce9 |