mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
fa9f581d56
* chore: move to new org * logging * fix: org rename caos -> zitadel Co-authored-by: adlerhurst <silvan.reusser@gmail.com>
33 lines
916 B
Go
33 lines
916 B
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net"
|
|
|
|
"github.com/zitadel/logging"
|
|
|
|
caos_errs "github.com/zitadel/zitadel/internal/errors"
|
|
es_models "github.com/zitadel/zitadel/internal/eventstore/v1/models"
|
|
)
|
|
|
|
type AuthRequest struct {
|
|
ID string `json:"id,omitempty"`
|
|
UserAgentID string `json:"userAgentID,omitempty"`
|
|
SelectedIDPConfigID string `json:"selectedIDPConfigID,omitempty"`
|
|
*BrowserInfo
|
|
}
|
|
|
|
type BrowserInfo struct {
|
|
UserAgent string `json:"userAgent,omitempty"`
|
|
AcceptLanguage string `json:"acceptLanguage,omitempty"`
|
|
RemoteIP net.IP `json:"remoteIP,omitempty"`
|
|
}
|
|
|
|
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
|
|
}
|