2021-03-26 00:17:52 +08:00
|
|
|
package models
|
|
|
|
|
2022-01-29 04:33:30 +08:00
|
|
|
import (
|
2024-02-28 09:46:51 +08:00
|
|
|
"net"
|
2022-06-28 01:51:09 +08:00
|
|
|
"strings"
|
2023-06-28 23:03:06 +08:00
|
|
|
"time"
|
2022-06-28 01:51:09 +08:00
|
|
|
|
2022-01-29 04:33:30 +08:00
|
|
|
jwt "github.com/golang-jwt/jwt/v4"
|
2022-12-21 04:29:09 +08:00
|
|
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
2022-01-29 04:33:30 +08:00
|
|
|
)
|
2021-03-26 00:17:52 +08:00
|
|
|
|
2023-03-07 04:54:50 +08:00
|
|
|
const (
|
|
|
|
// PLACEHOLDER_KEY_TEXT - access key placeholder text if option turned off
|
|
|
|
PLACEHOLDER_KEY_TEXT = "ACCESS_KEY"
|
|
|
|
// PLACEHOLDER_TOKEN_TEXT - access key token placeholder text if option turned off
|
|
|
|
PLACEHOLDER_TOKEN_TEXT = "ACCESS_TOKEN"
|
|
|
|
)
|
2021-11-17 01:20:48 +08:00
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// AuthParams - struct for auth params
|
2021-03-26 00:17:52 +08:00
|
|
|
type AuthParams struct {
|
2021-04-30 06:14:13 +08:00
|
|
|
MacAddress string `json:"macaddress"`
|
2022-01-11 06:52:21 +08:00
|
|
|
ID string `json:"id"`
|
2021-04-30 06:14:13 +08:00
|
|
|
Password string `json:"password"`
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// User struct - struct for Users
|
2021-03-26 00:17:52 +08:00
|
|
|
type User struct {
|
2023-10-02 12:57:58 +08:00
|
|
|
UserName string `json:"username" bson:"username" validate:"min=3,max=40,in_charset|email"`
|
|
|
|
Password string `json:"password" bson:"password" validate:"required,min=5"`
|
|
|
|
IsAdmin bool `json:"isadmin" bson:"isadmin"`
|
|
|
|
IsSuperAdmin bool `json:"issuperadmin"`
|
|
|
|
RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"`
|
|
|
|
LastLoginTime time.Time `json:"last_login_time"`
|
2021-07-24 06:24:34 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// ReturnUser - return user struct
|
2021-07-24 06:24:34 +08:00
|
|
|
type ReturnUser struct {
|
2023-10-02 12:57:58 +08:00
|
|
|
UserName string `json:"username"`
|
|
|
|
IsAdmin bool `json:"isadmin"`
|
|
|
|
IsSuperAdmin bool `json:"issuperadmin"`
|
|
|
|
RemoteGwIDs map[string]struct{} `json:"remote_gw_ids"`
|
|
|
|
LastLoginTime time.Time `json:"last_login_time"`
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// UserAuthParams - user auth params struct
|
2021-03-26 00:17:52 +08:00
|
|
|
type UserAuthParams struct {
|
2021-04-30 06:14:13 +08:00
|
|
|
UserName string `json:"username"`
|
|
|
|
Password string `json:"password"`
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// UserClaims - user claims struct
|
2021-03-26 00:17:52 +08:00
|
|
|
type UserClaims struct {
|
2023-09-01 16:57:08 +08:00
|
|
|
IsAdmin bool
|
|
|
|
IsSuperAdmin bool
|
|
|
|
UserName string
|
2022-06-27 22:47:28 +08:00
|
|
|
jwt.RegisteredClaims
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2023-09-01 16:57:08 +08:00
|
|
|
// IngressGwUsers - struct to hold users on a ingress gw
|
|
|
|
type IngressGwUsers struct {
|
|
|
|
NodeID string `json:"node_id"`
|
|
|
|
Network string `json:"network"`
|
|
|
|
Users []ReturnUser `json:"users"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// UserRemoteGws - struct to hold user's remote gws
|
|
|
|
type UserRemoteGws struct {
|
2023-12-07 03:57:58 +08:00
|
|
|
GwID string `json:"remote_access_gw_id"`
|
|
|
|
GWName string `json:"gw_name"`
|
|
|
|
Network string `json:"network"`
|
|
|
|
Connected bool `json:"connected"`
|
|
|
|
IsInternetGateway bool `json:"is_internet_gateway"`
|
|
|
|
GwClient ExtClient `json:"gw_client"`
|
2023-12-13 21:30:43 +08:00
|
|
|
GwPeerPublicKey string `json:"gw_peer_public_key"`
|
2024-05-09 15:30:21 +08:00
|
|
|
GwListenPort int `json:"gw_listen_port"`
|
2024-01-20 00:17:18 +08:00
|
|
|
Metadata string `json:"metadata"`
|
2024-05-08 17:15:05 +08:00
|
|
|
AllowedEndpoints []string `json:"allowed_endpoints"`
|
2024-06-03 14:25:07 +08:00
|
|
|
NetworkAddresses []string `json:"network_addresses"`
|
2023-09-01 16:57:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// UserRemoteGwsReq - struct to hold user remote acccess gws req
|
|
|
|
type UserRemoteGwsReq struct {
|
|
|
|
RemoteAccessClientID string `json:"remote_access_clientid"`
|
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// SuccessfulUserLoginResponse - successlogin struct
|
2021-03-26 00:17:52 +08:00
|
|
|
type SuccessfulUserLoginResponse struct {
|
2021-04-30 06:14:13 +08:00
|
|
|
UserName string
|
|
|
|
AuthToken string
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Claims is a struct that will be encoded to a JWT.
|
|
|
|
// jwt.StandardClaims is an embedded type to provide expiry time
|
|
|
|
type Claims struct {
|
2022-01-11 06:52:21 +08:00
|
|
|
ID string
|
2021-04-30 06:14:13 +08:00
|
|
|
MacAddress string
|
2022-01-11 06:52:21 +08:00
|
|
|
Network string
|
2022-06-27 22:47:28 +08:00
|
|
|
jwt.RegisteredClaims
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// SuccessfulLoginResponse is struct to send the request response
|
|
|
|
type SuccessfulLoginResponse struct {
|
2022-05-23 22:57:42 +08:00
|
|
|
ID string
|
|
|
|
AuthToken string
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// ErrorResponse is struct for error
|
2021-03-26 00:17:52 +08:00
|
|
|
type ErrorResponse struct {
|
2021-04-30 06:14:13 +08:00
|
|
|
Code int
|
|
|
|
Message string
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// NodeAuth - struct for node auth
|
2021-03-26 00:17:52 +08:00
|
|
|
type NodeAuth struct {
|
2021-04-30 06:14:13 +08:00
|
|
|
Network string
|
|
|
|
Password string
|
2022-01-11 06:52:21 +08:00
|
|
|
MacAddress string // Depricated
|
|
|
|
ID string
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// SuccessResponse is struct for sending error message with code.
|
|
|
|
type SuccessResponse struct {
|
2021-04-30 06:14:13 +08:00
|
|
|
Code int
|
|
|
|
Message string
|
|
|
|
Response interface{}
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// DisplayKey - what is displayed for key
|
2021-03-26 00:17:52 +08:00
|
|
|
type DisplayKey struct {
|
2021-04-30 06:14:13 +08:00
|
|
|
Name string `json:"name" bson:"name"`
|
|
|
|
Uses int `json:"uses" bson:"uses"`
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// GlobalConfig - global config
|
2021-04-06 02:47:07 +08:00
|
|
|
type GlobalConfig struct {
|
2022-04-22 03:53:44 +08:00
|
|
|
Name string `json:"name" bson:"name"`
|
2021-04-06 02:47:07 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// CheckInResponse - checkin response
|
2021-04-30 06:14:13 +08:00
|
|
|
type CheckInResponse struct {
|
|
|
|
Success bool `json:"success" bson:"success"`
|
|
|
|
NeedPeerUpdate bool `json:"needpeerupdate" bson:"needpeerupdate"`
|
|
|
|
NeedConfigUpdate bool `json:"needconfigupdate" bson:"needconfigupdate"`
|
|
|
|
NeedKeyUpdate bool `json:"needkeyupdate" bson:"needkeyupdate"`
|
|
|
|
NeedDelete bool `json:"needdelete" bson:"needdelete"`
|
|
|
|
NodeMessage string `json:"nodemessage" bson:"nodemessage"`
|
|
|
|
IsPending bool `json:"ispending" bson:"ispending"`
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// PeersResponse - peers response
|
2021-03-26 00:17:52 +08:00
|
|
|
type PeersResponse struct {
|
2021-08-31 03:58:23 +08:00
|
|
|
PublicKey string `json:"publickey" bson:"publickey"`
|
|
|
|
Endpoint string `json:"endpoint" bson:"endpoint"`
|
|
|
|
Address string `json:"address" bson:"address"`
|
|
|
|
Address6 string `json:"address6" bson:"address6"`
|
|
|
|
LocalAddress string `json:"localaddress" bson:"localaddress"`
|
2022-04-19 20:07:21 +08:00
|
|
|
LocalListenPort int32 `json:"locallistenport" bson:"locallistenport"`
|
2021-08-31 03:58:23 +08:00
|
|
|
IsEgressGateway string `json:"isegressgateway" bson:"isegressgateway"`
|
2021-07-27 22:48:58 +08:00
|
|
|
EgressGatewayRanges string `json:"egressgatewayrange" bson:"egressgatewayrange"`
|
2021-08-31 03:58:23 +08:00
|
|
|
ListenPort int32 `json:"listenport" bson:"listenport"`
|
|
|
|
KeepAlive int32 `json:"persistentkeepalive" bson:"persistentkeepalive"`
|
2021-07-24 06:24:34 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// ExtPeersResponse - ext peers response
|
2021-07-24 06:24:34 +08:00
|
|
|
type ExtPeersResponse struct {
|
2022-04-19 20:07:21 +08:00
|
|
|
PublicKey string `json:"publickey" bson:"publickey"`
|
|
|
|
Endpoint string `json:"endpoint" bson:"endpoint"`
|
|
|
|
Address string `json:"address" bson:"address"`
|
|
|
|
Address6 string `json:"address6" bson:"address6"`
|
|
|
|
LocalAddress string `json:"localaddress" bson:"localaddress"`
|
|
|
|
LocalListenPort int32 `json:"locallistenport" bson:"locallistenport"`
|
|
|
|
ListenPort int32 `json:"listenport" bson:"listenport"`
|
|
|
|
KeepAlive int32 `json:"persistentkeepalive" bson:"persistentkeepalive"`
|
2021-03-26 00:17:52 +08:00
|
|
|
}
|
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// EgressGatewayRequest - egress gateway request
|
2021-05-20 01:59:10 +08:00
|
|
|
type EgressGatewayRequest struct {
|
2022-09-01 20:10:49 +08:00
|
|
|
NodeID string `json:"nodeid" bson:"nodeid"`
|
|
|
|
NetID string `json:"netid" bson:"netid"`
|
|
|
|
NatEnabled string `json:"natenabled" bson:"natenabled"`
|
|
|
|
Ranges []string `json:"ranges" bson:"ranges"`
|
2021-04-13 11:19:01 +08:00
|
|
|
}
|
2021-09-14 08:25:27 +08:00
|
|
|
|
2021-10-09 03:07:12 +08:00
|
|
|
// RelayRequest - relay request struct
|
2021-09-14 08:25:27 +08:00
|
|
|
type RelayRequest struct {
|
2023-06-20 00:26:14 +08:00
|
|
|
NodeID string `json:"nodeid"`
|
|
|
|
NetID string `json:"netid"`
|
|
|
|
RelayedNodes []string `json:"relayaddrs"`
|
2021-09-18 22:33:14 +08:00
|
|
|
}
|
2022-01-18 22:06:43 +08:00
|
|
|
|
2023-01-10 22:27:05 +08:00
|
|
|
// HostRelayRequest - struct for host relay creation
|
2023-01-09 14:13:40 +08:00
|
|
|
type HostRelayRequest struct {
|
2023-01-11 09:59:33 +08:00
|
|
|
HostID string `json:"host_id"`
|
|
|
|
RelayedHosts []string `json:"relayed_hosts"`
|
2023-01-09 14:13:40 +08:00
|
|
|
}
|
|
|
|
|
2023-05-17 22:58:03 +08:00
|
|
|
// IngressRequest - ingress request struct
|
|
|
|
type IngressRequest struct {
|
2023-12-07 03:57:58 +08:00
|
|
|
ExtclientDNS string `json:"extclientdns"`
|
|
|
|
IsInternetGateway bool `json:"is_internet_gw"`
|
2024-05-17 18:45:32 +08:00
|
|
|
Metadata string `json:"metadata"`
|
2023-05-17 22:58:03 +08:00
|
|
|
}
|
|
|
|
|
2024-02-28 09:46:51 +08:00
|
|
|
// InetNodeReq - exit node request struct
|
|
|
|
type InetNodeReq struct {
|
|
|
|
InetNodeClientIDs []string `json:"inet_node_client_ids"`
|
|
|
|
}
|
|
|
|
|
2022-01-18 22:06:43 +08:00
|
|
|
// ServerUpdateData - contains data to configure server
|
|
|
|
// and if it should set peers
|
|
|
|
type ServerUpdateData struct {
|
2022-12-20 04:15:35 +08:00
|
|
|
UpdatePeers bool `json:"updatepeers" bson:"updatepeers"`
|
|
|
|
Node LegacyNode `json:"servernode" bson:"servernode"`
|
2022-01-18 22:06:43 +08:00
|
|
|
}
|
2022-01-21 06:50:42 +08:00
|
|
|
|
2022-01-21 06:52:49 +08:00
|
|
|
// Telemetry - contains UUID of the server and timestamp of last send to posthog
|
2022-01-30 07:04:36 +08:00
|
|
|
// also contains assymetrical encryption pub/priv keys for any server traffic
|
2022-01-21 06:50:42 +08:00
|
|
|
type Telemetry struct {
|
2022-01-30 04:02:37 +08:00
|
|
|
UUID string `json:"uuid" bson:"uuid"`
|
|
|
|
LastSend int64 `json:"lastsend" bson:"lastsend"`
|
|
|
|
TrafficKeyPriv []byte `json:"traffickeypriv" bson:"traffickeypriv"`
|
|
|
|
TrafficKeyPub []byte `json:"traffickeypub" bson:"traffickeypub"`
|
2022-01-21 06:50:42 +08:00
|
|
|
}
|
2022-01-26 23:40:39 +08:00
|
|
|
|
|
|
|
// ServerAddr - to pass to clients to tell server addresses and if it's the leader or not
|
|
|
|
type ServerAddr struct {
|
|
|
|
IsLeader bool `json:"isleader" bson:"isleader" yaml:"isleader"`
|
|
|
|
Address string `json:"address" bson:"address" yaml:"address"`
|
|
|
|
}
|
2022-01-29 04:33:30 +08:00
|
|
|
|
|
|
|
// TrafficKeys - struct to hold public keys
|
|
|
|
type TrafficKeys struct {
|
2022-01-30 04:02:37 +08:00
|
|
|
Mine []byte `json:"mine" bson:"mine" yaml:"mine"`
|
|
|
|
Server []byte `json:"server" bson:"server" yaml:"server"`
|
2022-01-29 04:33:30 +08:00
|
|
|
}
|
2022-04-26 04:30:18 +08:00
|
|
|
|
2023-03-23 02:47:13 +08:00
|
|
|
// HostPull - response of a host's pull
|
|
|
|
type HostPull struct {
|
2024-04-04 02:21:09 +08:00
|
|
|
Host Host `json:"host" yaml:"host"`
|
|
|
|
Nodes []Node `json:"nodes" yaml:"nodes"`
|
|
|
|
Peers []wgtypes.PeerConfig `json:"peers" yaml:"peers"`
|
|
|
|
ServerConfig ServerConfig `json:"server_config" yaml:"server_config"`
|
|
|
|
PeerIDs PeerMap `json:"peer_ids,omitempty" yaml:"peer_ids,omitempty"`
|
|
|
|
HostNetworkInfo HostInfoMap `json:"host_network_info,omitempty" yaml:"host_network_info,omitempty"`
|
|
|
|
EgressRoutes []EgressNetworkRoutes `json:"egress_network_routes"`
|
|
|
|
FwUpdate FwUpdate `json:"fw_update"`
|
|
|
|
ChangeDefaultGw bool `json:"change_default_gw"`
|
|
|
|
DefaultGwIp net.IP `json:"default_gw_ip"`
|
|
|
|
IsInternetGw bool `json:"is_inet_gw"`
|
|
|
|
EndpointDetection bool `json:"endpoint_detection"`
|
2024-02-28 09:46:51 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type DefaultGwInfo struct {
|
2023-03-23 02:47:13 +08:00
|
|
|
}
|
|
|
|
|
2022-04-26 04:30:18 +08:00
|
|
|
// NodeGet - struct for a single node get response
|
|
|
|
type NodeGet struct {
|
2023-02-21 23:31:37 +08:00
|
|
|
Node Node `json:"node" bson:"node" yaml:"node"`
|
2022-12-28 00:26:55 +08:00
|
|
|
Host Host `json:"host" yaml:"host"`
|
|
|
|
Peers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
|
2023-01-05 18:47:09 +08:00
|
|
|
HostPeers []wgtypes.PeerConfig `json:"host_peers" bson:"host_peers" yaml:"host_peers"`
|
2022-12-28 00:26:55 +08:00
|
|
|
ServerConfig ServerConfig `json:"serverconfig" bson:"serverconfig" yaml:"serverconfig"`
|
2023-01-05 12:01:31 +08:00
|
|
|
PeerIDs PeerMap `json:"peerids,omitempty" bson:"peerids,omitempty" yaml:"peerids,omitempty"`
|
2022-12-21 04:29:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// NodeJoinResponse data returned to node in response to join
|
|
|
|
type NodeJoinResponse struct {
|
2023-01-05 18:47:09 +08:00
|
|
|
Node Node `json:"node" bson:"node" yaml:"node"`
|
|
|
|
Host Host `json:"host" yaml:"host"`
|
|
|
|
ServerConfig ServerConfig `json:"serverconfig" bson:"serverconfig" yaml:"serverconfig"`
|
|
|
|
Peers []wgtypes.PeerConfig `json:"peers" bson:"peers" yaml:"peers"`
|
2022-06-01 00:07:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ServerConfig - struct for dealing with the server information for a netclient
|
|
|
|
type ServerConfig struct {
|
2024-07-09 21:26:55 +08:00
|
|
|
CoreDNSAddr string `yaml:"corednsaddr"`
|
|
|
|
API string `yaml:"api"`
|
|
|
|
APIPort string `yaml:"apiport"`
|
|
|
|
DNSMode string `yaml:"dnsmode"`
|
|
|
|
Version string `yaml:"version"`
|
|
|
|
MQPort string `yaml:"mqport"`
|
|
|
|
MQUserName string `yaml:"mq_username"`
|
|
|
|
MQPassword string `yaml:"mq_password"`
|
|
|
|
BrokerType string `yaml:"broker_type"`
|
|
|
|
Server string `yaml:"server"`
|
|
|
|
Broker string `yaml:"broker"`
|
|
|
|
IsPro bool `yaml:"isee" json:"Is_EE"`
|
|
|
|
TrafficKey []byte `yaml:"traffickey"`
|
|
|
|
MetricInterval string `yaml:"metric_interval"`
|
2022-04-26 04:30:18 +08:00
|
|
|
}
|
2022-06-28 01:51:09 +08:00
|
|
|
|
|
|
|
// User.NameInCharset - returns if name is in charset below or not
|
|
|
|
func (user *User) NameInCharSet() bool {
|
|
|
|
charset := "abcdefghijklmnopqrstuvwxyz1234567890-."
|
|
|
|
for _, char := range user.UserName {
|
|
|
|
if !strings.Contains(charset, strings.ToLower(string(char))) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
2022-09-12 20:36:17 +08:00
|
|
|
|
2022-09-12 20:41:21 +08:00
|
|
|
// ServerIDs - struct to hold server ids.
|
2022-09-12 20:36:17 +08:00
|
|
|
type ServerIDs struct {
|
|
|
|
ServerIDs []string `json:"server_ids"`
|
|
|
|
}
|
2022-12-20 04:15:35 +08:00
|
|
|
|
|
|
|
// JoinData - struct to hold data required for node to join a network on server
|
|
|
|
type JoinData struct {
|
2022-12-21 04:29:09 +08:00
|
|
|
Host Host `json:"host" yaml:"host"`
|
2022-12-20 04:15:35 +08:00
|
|
|
Node Node `json:"node" yaml:"node"`
|
|
|
|
Key string `json:"key" yaml:"key"`
|
|
|
|
}
|
2023-03-03 23:28:50 +08:00
|
|
|
|
2023-06-28 23:03:06 +08:00
|
|
|
// HookDetails - struct to hold hook info
|
|
|
|
type HookDetails struct {
|
|
|
|
Hook func() error
|
|
|
|
Interval time.Duration
|
|
|
|
}
|
|
|
|
|
|
|
|
// LicenseLimits - struct license limits
|
|
|
|
type LicenseLimits struct {
|
|
|
|
Servers int `json:"servers"`
|
|
|
|
Users int `json:"users"`
|
|
|
|
Hosts int `json:"hosts"`
|
|
|
|
Clients int `json:"clients"`
|
|
|
|
Networks int `json:"networks"`
|
|
|
|
}
|
2023-12-13 18:04:09 +08:00
|
|
|
|
|
|
|
type SignInReqDto struct {
|
|
|
|
FormFields FormFields `json:"formFields"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type FormField struct {
|
|
|
|
Id string `json:"id"`
|
|
|
|
Value any `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type FormFields []FormField
|
|
|
|
|
|
|
|
type SignInResDto struct {
|
|
|
|
Status string `json:"status"`
|
|
|
|
User User `json:"user"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type TenantLoginResDto struct {
|
|
|
|
Code int `json:"code"`
|
|
|
|
Message string `json:"message"`
|
|
|
|
Response struct {
|
|
|
|
UserName string `json:"UserName"`
|
|
|
|
AuthToken string `json:"AuthToken"`
|
|
|
|
} `json:"response"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type SsoLoginReqDto struct {
|
|
|
|
OauthProvider string `json:"oauthprovider"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type SsoLoginResDto struct {
|
|
|
|
User string `json:"UserName"`
|
|
|
|
AuthToken string `json:"AuthToken"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type SsoLoginData struct {
|
|
|
|
Expiration time.Time `json:"expiration"`
|
|
|
|
OauthProvider string `json:"oauthprovider,omitempty"`
|
|
|
|
OauthCode string `json:"oauthcode,omitempty"`
|
|
|
|
Username string `json:"username,omitempty"`
|
|
|
|
AmbAccessToken string `json:"ambaccesstoken,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type LoginReqDto struct {
|
|
|
|
Email string `json:"email"`
|
|
|
|
TenantID string `json:"tenant_id"`
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
ResHeaderKeyStAccessToken = "St-Access-Token"
|
|
|
|
)
|
2024-05-08 17:15:05 +08:00
|
|
|
|
|
|
|
type GetClientConfReqDto struct {
|
|
|
|
PreferredIp string `json:"preferred_ip"`
|
|
|
|
}
|