mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 04:57:33 +00:00
fix: user session with external login (#797)
* fix: user session with external login * fix: tests * fix: tests * fix: change idp config name
This commit is contained in:
@@ -1,22 +1,28 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/caos/logging"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
es_models "github.com/caos/zitadel/internal/eventstore/models"
|
||||
"net"
|
||||
|
||||
"github.com/caos/zitadel/internal/auth_request/model"
|
||||
)
|
||||
|
||||
type AuthRequest struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
UserAgentID string `json:"userAgentID,omitempty"`
|
||||
ID string `json:"id,omitempty"`
|
||||
UserAgentID string `json:"userAgentID,omitempty"`
|
||||
SelectedIDPConfigID string `json:"selectedIDPConfigID,omitempty"`
|
||||
*BrowserInfo
|
||||
}
|
||||
|
||||
func AuthRequestFromModel(request *model.AuthRequest) *AuthRequest {
|
||||
return &AuthRequest{
|
||||
ID: request.ID,
|
||||
UserAgentID: request.AgentID,
|
||||
BrowserInfo: BrowserInfoFromModel(request.BrowserInfo),
|
||||
ID: request.ID,
|
||||
UserAgentID: request.AgentID,
|
||||
BrowserInfo: BrowserInfoFromModel(request.BrowserInfo),
|
||||
SelectedIDPConfigID: request.SelectedIDPConfigID,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,3 +39,11 @@ func BrowserInfoFromModel(info *model.BrowserInfo) *BrowserInfo {
|
||||
RemoteIP: info.RemoteIP,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AuthRequest) SetData(event *es_models.Event) error {
|
||||
if err := json.Unmarshal(event.Data, a); err != nil {
|
||||
logging.Log("EVEN-T5df6").WithError(err).Error("could not unmarshal event data")
|
||||
return caos_errs.ThrowInternal(err, "MODEL-yGmhh", "could not unmarshal event")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -84,6 +84,8 @@ const (
|
||||
HumanPasswordCheckSucceeded models.EventType = "user.human.password.check.succeeded"
|
||||
HumanPasswordCheckFailed models.EventType = "user.human.password.check.failed"
|
||||
|
||||
HumanExternalLoginCheckSucceeded models.EventType = "user.human.externallogin.check.succeeded"
|
||||
|
||||
HumanExternalIDPReserved models.EventType = "user.human.externalidp.reserved"
|
||||
HumanExternalIDPReleased models.EventType = "user.human.externalidp.released"
|
||||
|
||||
|
Reference in New Issue
Block a user