sso
sso 单点登录
1 单点登录时序图
+-----------------+ +---------------------+ +-----------+
|~* /static/ | |= /auth/verification | |/ |
|= /index_sso.html| |= /butterfly_401 | | | Nginx 配置
|= / | |= /auth/ssologin | | |
+-----------------+ +---------------------+ +-----------+
| | |
+----------+ +---------------+ +--------------+ +----------+ +-----------+
|web browse| |butterfly-admin| |butterfly-auth| |cas-server| |app-backend| 服务
+----------+ +---------------+ +--------------+ +----------+ +-----------+
| | | | |
+-------route------->|/ | | |
|<-------page--------+/index_sso.html | | |
| | | | |
====================================================================not have token
| | | | |
+--V----------------request api---------------------------------------------------->| 1 客户端请求后端接口返回 401
| +-sub request-header not have token--->|(/auth/verification) | |
|<-code=401,targetURL=/auth/ssologin------+ | |
| | | | |
+--window.location.herf=directurl-------->|(/auth/ssologin) | | 2 客户端设置当前页面的 URL 地址为 /auth/ssologin
|<----code=302,Location=cas-server--------+ | |
| | | | |
+-----302 http://cas-server/login login page ----------------->|(/login) | 3 客户端根据 butterfly-auth 返回内容重定向到 cas-server
|<-------------code=302,set Cookie TGT=xxx ---------------------+ |
| | | | |
+-----302 /auth/ssologin?ticket=xxx ----->|(/auth/ssologin) | | 4 客户端根据 cas-server 返回内容重定向到 /auth/ssologin
| | +-------check st----->|(/session/validate)|
| | |<-------st vaild-----+ |
|<--code=302 set Cookie butterfly_token---+ | |
| | | | |
+--302 / ----------->| | | | 5 客户端重新请求首页
|<-------page--------+/index_sso.html | | |
| | | | |
======================================================================== have token
| | | | |
+---V----------------request api--------------------------------------------------->|
| +-sub request-header have token------>|(/auth/verification) | |
|<-------------------response-------------------------------------------------------+2 butterfly-admin 关键点
2.1 nginx auth request
2.2 amis 全局适配器
2.3 Token 存储方式
2.4 username 传递
Last updated