http://127.0.0.1:5000
SSO 配置管理
这里集中维护 SSO 的站点接入配置,包括业务站点的 domain_url 白名单和 session_life_limit。
站点接入说明
- 业务站点发起登录时,请跳转到:
/auth/login_ssl?redirect_url=your_redirect_url×tamp=unix_ts&signature=hex_hmac_sha256;如需切换账号,可追加force_login=1跳过 SSO 本地缓存。 - 业务站点建议先调用:
/auth/check_is_login?redirect_url=your_redirect_url×tamp=unix_ts&signature=hex_hmac_sha256 check_is_login会校验时间戳和签名;若已登录,直接返回用户信息给业务站点复用。- 若
data.user = null,再跳转到/auth/login_ssl进行飞书登录。 - 签名规则:
hex(hmac_sha256(SSO_SIGNATURE_SECRET, timestamp + "\n" + redirect_url)) - 固定回调地址是:
domain_url + /sso_callback。 - 业务站点退出时,请让浏览器直接访问
/auth/logout?redirect_url=...或提交POST /auth/logout;接口会先清除 SSO 中心保存的用户身份,再跳转回业务站点。 - 跨站 POST/fetch 退出需要浏览器携带 SSO cookie;HTTPS 下可配置
SESSION_COOKIE_SAMESITE=None和SESSION_COOKIE_SECURE=true。 force_login=1和/auth/logout只清除本项目的 SSO 身份;如果浏览器仍登录原飞书账号,重新授权时飞书仍可能返回原用户,需要先在飞书侧切换或退出账号。- 白名单只维护
domain_url,不需要 path。
新增 Domain
Session 配置
当前 session_life_limit 表示 SSO 登录态有效期,单位为秒。
7200 秒
接入示例
允许的 domain_url
http://127.0.0.1:5000
http://127.0.0.1:5000/sso_callback
http://127.0.0.1:5000/test-result?from=whitelist
https://sso.365d4u.com/auth/login_ssl?redirect_url=http://127.0.0.1:5000/test-result?from%3Dwhitelist×tamp=1785318163&signature=b41eaa9fb6390c02f46672100de78dd1945cd60d6ada066f645c303ca1714845
允许的 domain_url
http://127.0.0.1:8079
http://127.0.0.1:8079/sso_callback
http://127.0.0.1:8079/test-result?from=whitelist
https://sso.365d4u.com/auth/login_ssl?redirect_url=http://127.0.0.1:8079/test-result?from%3Dwhitelist×tamp=1785318163&signature=9131896c9538e92a0eaa62bebef9aa0cffb3ec40a94ed2ba1dd73398a23a4c18
允许的 domain_url
http://host365d.local
http://host365d.local/sso_callback
http://host365d.local/test-result?from=whitelist
https://sso.365d4u.com/auth/login_ssl?redirect_url=http://host365d.local/test-result?from%3Dwhitelist×tamp=1785318163&signature=2b42ee14f9b81bfd39283e25d11959a10056014d692214adc139d3921f5db6a8
当前 domain_url 白名单
http://127.0.0.1:8079
http://host365d.local
https://devlocal.365d4u.com
https://msg.365d4u.com
https://newsystem.365d4u.com
https://newsystemtest.365d4u.com
https://price.365d4u.cn
https://respondstat.365d4u.com
https://sso.365d4u.com
https://test.365d4u.com
https://www.365d4u.com