Files
jiang13-forum/models/oauth.go
freefire 9fe299a45f refactor: Gitea 式目录改组,移除本分支 SPA 与杂项产物
将 model/service/handler/middleware 迁至 models/services/routers/api/modules/auth,并删除 frontend、embed_static、scripts 及误入库缓存/二进制。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-29 03:54:56 +08:00

32 lines
1.4 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 model
import "time"
// OAuthClient OIDC/OAuth2 客户端应用(密钥仅存 bcrypt 哈希)
type OAuthClient struct {
ID uint `gorm:"primaryKey" json:"id"`
ClientID string `gorm:"uniqueIndex;size:128;not null" json:"client_id"`
ClientSecretHash string `gorm:"size:128;not null" json:"-"`
Name string `gorm:"size:128;not null" json:"name"`
RedirectURIs string `gorm:"size:2048;not null" json:"redirect_uris"`
Enabled bool `gorm:"default:true" json:"enabled"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// OAuthAuthCode 一次性授权码OIDC Authorization Code Flow
type OAuthAuthCode struct {
ID uint `gorm:"primaryKey"`
Code string `gorm:"uniqueIndex;size:64;not null"`
ClientID string `gorm:"size:128;not null;index"`
UserID uint `gorm:"not null;index"`
RedirectURI string `gorm:"size:512;not null"`
Scope string `gorm:"size:256;default:''"`
Nonce string `gorm:"size:128;default:''"`
CodeChallenge string `gorm:"size:128;default:''"`
CodeChallengeMethod string `gorm:"size:16;default:''"`
ExpiresAt time.Time `gorm:"not null;index"`
Used bool `gorm:"default:false"`
CreatedAt time.Time
}