feat(auth): 支持多渠道登录态管理并新增webview重定向功能
- 修改get_current_user函数同时支持Authorization header和cookie获取token - 在logout接口中添加JSONResponse并清除webview cookie登录态 - 新增webview模块实现URL token到cookie的转换和安全重定向功能 - 实现域名白名单校验防止开放重定向漏洞 - 在main.py中注册webview路由
This commit is contained in:
4
main.py
4
main.py
@@ -5,7 +5,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from server_prd.routes import auth, checkin, course_vote, feedback, pages, plan, profile, survey, yijing
|
||||
from server_prd.routes import auth, checkin, course_vote, feedback, pages, plan, profile, survey, webview, yijing
|
||||
|
||||
app = FastAPI(title="明缘进阶场 API")
|
||||
app.include_router(auth.router)
|
||||
@@ -17,6 +17,7 @@ app.include_router(survey.router)
|
||||
app.include_router(feedback.router)
|
||||
app.include_router(course_vote.router)
|
||||
app.include_router(yijing.router)
|
||||
app.include_router(webview.router)
|
||||
|
||||
|
||||
@app.get("/api/v1/health")
|
||||
@@ -27,3 +28,4 @@ def health():
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run("server_prd.main:app", host="127.0.0.1", port=8000, reload=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user