feat(oauth): Oauth nonce (#148)

This commit is contained in:
lejianwen
2025-02-26 16:36:53 +08:00
parent 0dd92311b2
commit 0f16f61ab3
4 changed files with 31 additions and 22 deletions

View File

@@ -43,17 +43,18 @@ func (o *Oauth) ToBind(c *gin.Context) {
return
}
err, state, verifier, url := service.AllService.OauthService.BeginAuth(f.Op)
err, state, verifier, nonce, url := service.AllService.OauthService.BeginAuth(f.Op)
if err != nil {
response.Error(c, response.TranslateMsg(c, err.Error()))
return
}
service.AllService.OauthService.SetOauthCache(state, &service.OauthCacheItem{
Action: service.OauthActionTypeBind,
Op: f.Op,
UserId: u.Id,
Verifier: verifier,
Action: service.OauthActionTypeBind,
Op: f.Op,
UserId: u.Id,
Verifier: verifier,
Nonce: nonce,
}, 5*60)
response.Success(c, gin.H{