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.1.tar.gz
(7.8 kB
view hashes)
Built Distribution
Close
Hashes for FastAPI_battery-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 335824776ded8f410370729063f67053ecbdbdb37feedef936020820b811811e |
|
MD5 | 6af8b3423236eb4ac1c40fd1b8d00f90 |
|
BLAKE2b-256 | 31c0f5c6fa6ecbdb029c5b5ad4c9c92db8aa927e560dd0c33fa7029ff3322ba5 |