Files
yunzerwebsiteallinone/go/models/auth_client.go
T
2026-09-19 21:44:04 +08:00

44 lines
2.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "time"
// 接入应用类型
const (
AuthAppTypeWeb = 1 // 有后端的 Web 应用(可安全保存 secret)
AuthAppTypeSPA = 2 // 单页应用(只能走 PKCE,不存 secret)
AuthAppTypeNative = 3 // 原生 APP / uniapp
AuthAppTypeMiniProg = 4 // 小程序
)
// 领域隔离:租户域与平台域使用不同 realm,避免平台账号登录租户应用
const (
AuthRealmTenant = "tenant"
AuthRealmPlatform = "platform"
)
// AuthClient 接入应用(OIDC Client):yz_auth_client
// 以后每开发一个新软件,只需在这里注册一条即可接入统一认证。
type AuthClient struct {
ID uint64 `orm:"column(id);pk;auto" json:"id"`
ClientID string `orm:"column(client_id);size(64)" json:"client_id"`
ClientSecret *string `orm:"column(client_secret);size(128);null" json:"-"`
AppCode string `orm:"column(app_code);size(32)" json:"app_code"`
Name string `orm:"column(name);size(128)" json:"name"`
AppType int8 `orm:"column(app_type);default(1)" json:"app_type"`
RedirectURIs *string `orm:"column(redirect_uris);type(text);null" json:"redirect_uris"`
PostLogoutURIs *string `orm:"column(post_logout_uris);type(text);null" json:"post_logout_uris"`
BackchannelLogoutURI *string `orm:"column(backchannel_logout_uri);size(500);null" json:"backchannel_logout_uri"`
GrantTypes string `orm:"column(grant_types);size(255)" json:"grant_types"`
Scope *string `orm:"column(scope);size(255);null" json:"scope"`
AccessTTL int `orm:"column(access_ttl);default(1800)" json:"access_ttl"`
RefreshTTL int `orm:"column(refresh_ttl);default(2592000)" json:"refresh_ttl"`
Realm string `orm:"column(realm);size(16);default(tenant)" json:"realm"`
Status int8 `orm:"column(status);default(1)" json:"status"`
CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"`
UpdateTime *time.Time `orm:"column(update_time);type(datetime);null" json:"update_time"`
}
func (m *AuthClient) TableName() string {
return "yz_auth_client"
}