Gitpod登录鉴权流程
2022-08-26 10:23:02 6 举报
登录查看完整内容
Gitpod-OAuth2-登录鉴权流程
作者其他创作
大纲/内容
TosFlow.WithIdentity.is(flowContext)?
Yes
前台程序POST URL \"/authorize\"
使用获得的accessToken通过Octokit组件与Github API交互,获取user profile information与UserEmails信息,并从UserEmails信息中筛选出primaryEmail,最终返回AuthUserSetup
Session: authFlow tosFlow
Oauth Application 注册
HTTP
前台(React)dashboard
重定向至\"/complete-auth?message=success\"结束登录鉴权流程
Server后台响应\"/auth/github.com/callback\"接收Code授权码
Domain:sdz.myetslab.comOauth application: github application (authProvider 设置为github)
前台程序POST URL \"/login\"
按照repositoryPatternspan style=\
验证returnto参数信息
github 交互顺序
调用异步passport.authenticate方法发送\"/login/oauth/access_token\"URL向github请求Token令牌,并await等待返回result (passport设置verify回调函数)
type:MySQL
HTTPS
Server后台响应\"/authorize\"
存入user(name、avatarUrl)、candidate(authProviderId、authUser)与token至数据库
Github
passport中间件根据strategy发送“/login/oauth/authorize”URL向github请求Code授权码
重定向\"/authorize?scope=新scope\"至后台重新开始鉴权流程
使用express req.login方法建立login session,将User绑定至req.User
Dashboard登录页面点击\"Continue with Github\"按钮
跳转用户Github登录界面进行用户登录
No
github 发送accessToken、refreshToken至gitpod后台,并调用verify回调函数(strategy中设置)
server接收\"/api/tos?mode=login\",使用identity与token信息在数据库中创建Gitpod新用户
scopes是否发生变化?
github返回URL\"/auth/github.com/callback?code=xxx\"传递授权码至gitpod后台,并将req.usr存至session
后台(Node.js)server
用户信息存入Session
调用passport.authenticate方法进行登录验证
回调函数返回flowContext信息(githubIdentity、returnto、host等)
在数据库中更新用户name、avatarUrl、blocked等github账户信息
Client ID:93321ce2e448a882b968Client secrets: 4b85bf4135f7877494273fea09d81194c6277d7dCallbackURL: https://swddd.rdsec.xyz/auth/github.com/callback
保存gitpod登录信息flowContext至session,并重定向至\"/api/tos?mode=login\"
Server后台响应\"/login\"
Github是否已登录?
回调返回
Gitpod登录鉴权流程
结束
接收verify回调函数返回result(githubIdentity、githubToken等)
收藏
0 条评论
回复 删除
下一页