feat: fix bugs in webauthn (#1173)

This commit is contained in:
Товарищ программист
2022-10-01 11:10:55 +08:00
committed by GitHub
parent 645c631db9
commit 9c48582e0c
3 changed files with 10 additions and 3 deletions

View File

@ -121,6 +121,7 @@ func (c *ApiController) WebAuthnSigninBegin() {
// @Success 200 {object} Response "The Response object"
// @router /webauthn/signin/finish [post]
func (c *ApiController) WebAuthnSigninFinish() {
responseType := c.Input().Get("responseType")
webauthnObj := object.GetWebAuthnObject(c.Ctx.Request.Host)
sessionObj := c.GetSession("authentication")
sessionData, ok := sessionObj.(webauthn.SessionData)
@ -138,5 +139,11 @@ func (c *ApiController) WebAuthnSigninFinish() {
}
c.SetSessionUsername(userId)
util.LogInfo(c.Ctx, "API: [%s] signed in", userId)
c.ResponseOk(userId)
application := object.GetApplicationByUser(user)
var form RequestForm
form.Type = responseType
resp := c.HandleLoggedIn(application, user, &form)
c.Data["json"] = resp
c.ServeJSON()
}