mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-15 20:38:00 +00:00
36 lines
828 B
Go
36 lines
828 B
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
|
||
|
"github.com/caos/zitadel/internal/auth_request/model"
|
||
|
)
|
||
|
|
||
|
type AuthRequest struct {
|
||
|
ID string `json:"id,omitempty"`
|
||
|
UserAgentID string `json:"userAgentID,omitempty"`
|
||
|
*BrowserInfo
|
||
|
}
|
||
|
|
||
|
func AuthRequestFromModel(request *model.AuthRequest) *AuthRequest {
|
||
|
return &AuthRequest{
|
||
|
ID: request.ID,
|
||
|
UserAgentID: request.AgentID,
|
||
|
BrowserInfo: BrowserInfoFromModel(request.BrowserInfo),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
type BrowserInfo struct {
|
||
|
UserAgent string `json:"userAgent,omitempty"`
|
||
|
AcceptLanguage string `json:"acceptLanguage,omitempty"`
|
||
|
RemoteIP net.IP `json:"remoteIP,omitempty"`
|
||
|
}
|
||
|
|
||
|
func BrowserInfoFromModel(info *model.BrowserInfo) *BrowserInfo {
|
||
|
return &BrowserInfo{
|
||
|
UserAgent: info.UserAgent,
|
||
|
AcceptLanguage: info.AcceptLanguage,
|
||
|
RemoteIP: info.RemoteIP,
|
||
|
}
|
||
|
}
|