2025-11-24 18:44:06 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"platform/web/core"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Client 客户端表
|
|
|
|
|
|
type Client struct {
|
|
|
|
|
|
core.Model
|
2025-12-15 14:48:30 +08:00
|
|
|
|
ClientID string `json:"client_id" gorm:"column:client_id"` // OAuth2客户端标识符
|
2026-04-11 09:51:25 +08:00
|
|
|
|
ClientSecret string `json:"-" gorm:"column:client_secret"` // OAuth2客户端密钥
|
2025-12-15 14:48:30 +08:00
|
|
|
|
RedirectURI *string `json:"redirect_uri,omitempty" gorm:"column:redirect_uri"` // OAuth2 重定向URI
|
|
|
|
|
|
Spec ClientSpec `json:"spec" gorm:"column:spec"` // 安全规范:1-native,2-browser,3-web,4-api
|
|
|
|
|
|
Name string `json:"name" gorm:"column:name"` // 名称
|
|
|
|
|
|
Icon *string `json:"icon,omitempty" gorm:"column:icon"` // 图标URL
|
|
|
|
|
|
Status ClientStatus `json:"status" gorm:"column:status"` // 状态:0-禁用,1-正常
|
|
|
|
|
|
Type ClientType `json:"type" gorm:"column:type"` // 类型:0-普通,1-官方
|
2026-03-18 18:09:32 +08:00
|
|
|
|
|
|
|
|
|
|
Permissions []*Permission `json:"permissions" gorm:"many2many:link_client_permission"`
|
2025-11-24 18:44:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ClientSpec 客户端安全规范枚举
|
|
|
|
|
|
type ClientSpec int
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
ClientSpecNative ClientSpec = 1 // native
|
|
|
|
|
|
ClientSpecBrowser ClientSpec = 2 // browser
|
|
|
|
|
|
ClientSpecWeb ClientSpec = 3 // web
|
|
|
|
|
|
ClientSpecAPI ClientSpec = 4 // api
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ClientStatus 客户端状态枚举
|
|
|
|
|
|
type ClientStatus int
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
ClientStatusDisabled ClientStatus = 0 // 禁用
|
|
|
|
|
|
ClientStatusEnabled ClientStatus = 1 // 正常
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ClientType 客户端类型枚举
|
|
|
|
|
|
type ClientType int
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
|
ClientTypeNormal ClientType = 0 // 普通
|
|
|
|
|
|
ClientTypeOfficial ClientType = 1 // 官方
|
|
|
|
|
|
)
|