store oauth 2.0 user info in token context instead of being passed through frontend parameters

This commit is contained in:
MaysWind
2025-10-21 23:49:18 +08:00
parent 13ada3575a
commit 46e275d843
31 changed files with 174 additions and 83 deletions
-1
View File
@@ -14,6 +14,5 @@ type OAuth2CallbackRequest struct {
// OAuth2CallbackLoginRequest represents all parameters of OAuth 2.0 callback login request
type OAuth2CallbackLoginRequest struct {
Provider string `json:"provider" binding:"required,notBlank"`
Password string `json:"password" binding:"omitempty,min=6,max=128"`
}
+8
View File
@@ -12,11 +12,19 @@ type TokenRecord struct {
TokenType core.TokenType `xorm:"INDEX(IDX_token_record_uid_type_expired_time) TINYINT NOT NULL"`
Secret string `xorm:"VARCHAR(10) NOT NULL"`
UserAgent string `xorm:"VARCHAR(255)"`
Context string `xorm:"BLOB"`
CreatedUnixTime int64 `xorm:"PK"`
ExpiredUnixTime int64 `xorm:"INDEX(IDX_token_record_uid_type_expired_time) INDEX(IDX_token_record_expired_time)"`
LastSeenUnixTime int64
}
// OAuth2CallbackTokenContext represents the context data of oauth 2.0 callback token
type OAuth2CallbackTokenContext struct {
ExternalAuthType core.UserExternalAuthType `json:"externalAuthType"`
ExternalUsername string `json:"externalUsername"`
ExternalEmail string `json:"externalEmail"`
}
// TokenGenerateMCPRequest represents all parameters of mcp token generation request
type TokenGenerateMCPRequest struct {
Password string `json:"password" binding:"omitempty,min=6,max=128"`