70 lines
1.8 KiB
Go
70 lines
1.8 KiB
Go
package auth
|
|
|
|
// PasswordAccount 是用户主动设置密码后的密码身份记录。
|
|
// 登录入口使用 user.current_display_user_id 解析用户,不再维护独立账号命名空间。
|
|
type PasswordAccount struct {
|
|
UserID int64
|
|
DisplayUserID string
|
|
PasswordHash string
|
|
HashAlg string
|
|
CreatedAtMs int64
|
|
UpdatedAtMs int64
|
|
}
|
|
|
|
// Token 表达 user-service 签发给 gateway 的登录结果。
|
|
// refresh token 原文只能出现在返回路径,持久化层必须保存 hash。
|
|
type Token struct {
|
|
UserID int64
|
|
DisplayUserID string
|
|
DefaultDisplayUserID string
|
|
DisplayUserIDKind string
|
|
DisplayUserIDExpiresAtMs int64
|
|
SessionID string
|
|
AccessToken string
|
|
RefreshToken string
|
|
ExpiresInSec int64
|
|
TokenType string
|
|
}
|
|
|
|
// Session 表达服务端会话和 refresh token 生命周期。
|
|
type Session struct {
|
|
SessionID string
|
|
UserID int64
|
|
RefreshTokenHash string
|
|
DeviceID string
|
|
ExpiresAtMs int64
|
|
RevokedAtMs int64
|
|
CreatedAtMs int64
|
|
UpdatedAtMs int64
|
|
}
|
|
|
|
// ThirdPartyIdentity 是 provider + subject 到用户的稳定绑定。
|
|
type ThirdPartyIdentity struct {
|
|
UserID int64
|
|
Provider string
|
|
ProviderSubject string
|
|
ProviderUnionID string
|
|
CreatedAtMs int64
|
|
UpdatedAtMs int64
|
|
}
|
|
|
|
// LoginAudit 是登录注册链路的审计记录。
|
|
// 审计不能包含密码、三方 credential 或 refresh token 原文。
|
|
type LoginAudit struct {
|
|
RequestID string
|
|
UserID int64
|
|
LoginType string
|
|
Provider string
|
|
Result string
|
|
FailureCode string
|
|
ClientIP string
|
|
UserAgent string
|
|
CreatedAtMs int64
|
|
}
|
|
|
|
// ThirdPartyProfile 是三方凭证校验后的稳定身份结果。
|
|
type ThirdPartyProfile struct {
|
|
ProviderSubject string
|
|
ProviderUnionID string
|
|
}
|