package models import "time" // 租户自带身份源 provider const ( TenantIdPDingTalk = "dingtalk" TenantIdPFeishu = "feishu" TenantIdPWeWork = "wework" TenantIdPOIDC = "oidc" TenantIdPSAML = "saml" ) // AuthTenantIdp 租户自带身份源:yz_auth_tenant_idp // 企业客户可配置自己的钉钉/飞书/企业微信或标准 OIDC/SAML 上游, // 登录时按 tid 路由到对应身份源(第10条需求)。 type AuthTenantIdp struct { ID uint64 `orm:"column(id);pk;auto" json:"id"` Tid uint64 `orm:"column(tid)" json:"tid"` Provider string `orm:"column(provider);size(32)" json:"provider"` Name *string `orm:"column(name);size(128);null" json:"name"` AppID *string `orm:"column(app_id);size(128);null" json:"app_id"` AppSecret *string `orm:"column(app_secret);size(512);null" json:"-"` Issuer *string `orm:"column(issuer);size(500);null" json:"issuer"` AuthURL *string `orm:"column(auth_url);size(500);null" json:"auth_url"` TokenURL *string `orm:"column(token_url);size(500);null" json:"token_url"` UserinfoURL *string `orm:"column(userinfo_url);size(500);null" json:"userinfo_url"` JwksURL *string `orm:"column(jwks_url);size(500);null" json:"jwks_url"` Scopes *string `orm:"column(scopes);size(255);null" json:"scopes"` AttrMap *string `orm:"column(attr_map);type(text);null" json:"attr_map"` ProxyURL *string `orm:"column(proxy_url);size(500);null" json:"proxy_url"` 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 *AuthTenantIdp) TableName() string { return "yz_auth_tenant_idp" } // 并发超限策略 const ( KickStrategyKickOld = 1 // 踢掉旧会话(默认) KickStrategyReject = 2 // 拒绝新登录 ) // AuthTenantAuthConfig 租户登录策略:yz_auth_tenant_auth_config // 每个租户可自定义验证码方式、密码强度、会话时长与并发设备数。 type AuthTenantAuthConfig struct { Tid uint64 `orm:"column(tid);pk" json:"tid"` VerifyType string `orm:"column(verify_type);size(20);default(captcha)" json:"verify_type"` OpenVerify int8 `orm:"column(open_verify);default(1)" json:"open_verify"` PwdMinLen int `orm:"column(pwd_min_len);default(8)" json:"pwd_min_len"` PwdComplexity int8 `orm:"column(pwd_complexity);default(0)" json:"pwd_complexity"` SessionTTL int `orm:"column(session_ttl);default(7200)" json:"session_ttl"` MaxSession int `orm:"column(max_session);default(1)" json:"max_session"` KickStrategy int8 `orm:"column(kick_strategy);default(1)" json:"kick_strategy"` MfaRequired int8 `orm:"column(mfa_required);default(0)" json:"mfa_required"` IPWhitelist *string `orm:"column(ip_whitelist);type(text);null" json:"ip_whitelist"` AllowThird *string `orm:"column(allow_third);size(255);null" json:"allow_third"` UpdateTime *time.Time `orm:"column(update_time);type(datetime);null" json:"update_time"` } func (m *AuthTenantAuthConfig) TableName() string { return "yz_auth_tenant_auth_config" }