mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
feat: when logging in with OAuth2 and authenticating via WebAuthn, retrieve the application from the clientId (#2469)
* fix: #2304 * fix: when logging in with OAuth2 and authenticating via WebAuthn, retrieve the application from the clientId. --------- Co-authored-by: aidenlu <aiden_lu@wochacha.com>
This commit is contained in:
parent
e082cf10e0
commit
477a090aa0
@ -154,6 +154,7 @@ func (c *ApiController) WebAuthnSigninBegin() {
|
||||
// @router /webauthn/signin/finish [post]
|
||||
func (c *ApiController) WebAuthnSigninFinish() {
|
||||
responseType := c.Input().Get("responseType")
|
||||
clientId := c.Input().Get("clientId")
|
||||
webauthnObj, err := object.GetWebAuthnObject(c.Ctx.Request.Host)
|
||||
if err != nil {
|
||||
c.ResponseError(err.Error())
|
||||
@ -182,7 +183,13 @@ func (c *ApiController) WebAuthnSigninFinish() {
|
||||
c.SetSessionUsername(userId)
|
||||
util.LogInfo(c.Ctx, "API: [%s] signed in", userId)
|
||||
|
||||
application, err := object.GetApplicationByUser(user)
|
||||
var application *object.Application
|
||||
|
||||
if clientId != "" && (responseType == ResponseTypeCode) {
|
||||
application, err = object.GetApplicationByClientId(clientId)
|
||||
} else {
|
||||
application, err = object.GetApplicationByUser(user)
|
||||
}
|
||||
if err != nil {
|
||||
c.ResponseError(err.Error())
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user