Resolve Feishu names by verified open ID and scope VPN member access

This commit is contained in:
Codex committed 2026-10-23 02:02:52 +08:00
1 parent 578a58a129
commit d4eddf7365
19 files changed
+837 -35

No files matched your search

+22 -12
View File
@@ -31,14 +31,24 @@ type IdentityGrant struct {
// IdentityProfile is display metadata from a verified Feishu user-info response.
// It grants no VPN permissions and contains no upstream access token.
type IdentityProfile struct {
ID uint `gorm:"primaryKey"`
Issuer string `gorm:"uniqueIndex:idx_identity_profile;size:256"`
AppID string `gorm:"uniqueIndex:idx_identity_profile;size:128"`
Subject string `gorm:"uniqueIndex:idx_identity_profile;size:256"`
Name string `gorm:"size:256"`
ID uint `gorm:"primaryKey"`
Issuer string `gorm:"uniqueIndex:idx_identity_profile;size:256"`
AppID string `gorm:"uniqueIndex:idx_identity_profile;size:128"`
Subject string `gorm:"uniqueIndex:idx_identity_profile;size:256"`
Name string `gorm:"size:256"`
UpdatedAt time.Time
}
// FeishuTunnelGrant records explicit admission for a verified Feishu subject.
type FeishuTunnelGrant struct {
ID uint `gorm:"primaryKey" json:"id"`
TunnelID uint `gorm:"uniqueIndex:idx_feishu_tunnel_grant" json:"tunnel_id"`
Issuer string `gorm:"uniqueIndex:idx_feishu_tunnel_grant;size:256" json:"-"`
AppID string `gorm:"uniqueIndex:idx_feishu_tunnel_grant;size:128" json:"-"`
Subject string `gorm:"uniqueIndex:idx_feishu_tunnel_grant;size:256" json:"subject"`
CreatedAt time.Time `json:"created_at"`
}
// TrafficSample 流量时间序列采样(每 60 秒一次,用于趋势图) // Logan.Li
type TrafficSample struct {
ID uint `gorm:"primaryKey" json:"id"`
@@ -204,13 +214,13 @@ type VPNSession struct {
// ConnectionLog 连接审计日志(连接/断开/认证失败/配额超额/异常流量) // Logan.Li
type ConnectionLog struct {
DisplayName string `gorm:"size:256" json:"display_name,omitempty"`
ID uint `gorm:"primaryKey" json:"id"`
TunnelID uint `gorm:"index" json:"tunnel_id"`
Username string `gorm:"size:128" json:"username"`
Event string `gorm:"size:32" json:"event"` // connect / disconnect / auth_fail / quota_exceed / rate_alert
IPAddress string `gorm:"size:64" json:"ip_address"`
Detail string `gorm:"size:1024" json:"detail"`
CreatedAt time.Time `json:"created_at"`
ID uint `gorm:"primaryKey" json:"id"`
TunnelID uint `gorm:"index" json:"tunnel_id"`
Username string `gorm:"size:128" json:"username"`
Event string `gorm:"size:32" json:"event"` // connect / disconnect / auth_fail / quota_exceed / rate_alert
IPAddress string `gorm:"size:64" json:"ip_address"`
Detail string `gorm:"size:1024" json:"detail"`
CreatedAt time.Time `json:"created_at"`
}
// ClientDevice 终端用户设备(桌面/移动客户端注册)。