更新依赖项,优化 OAuth2 服务,添加 PKCE 支持,增强 OIDC 处理器,新增客户端注册和令牌管理端点,改进数据库模型以支持新功能。

This commit is contained in:
2025-04-17 01:25:46 +08:00
parent 0368547137
commit a3f3cc17cf
13 changed files with 738 additions and 70 deletions

View File

@@ -3,19 +3,30 @@ package models
import (
"time"
"gorm.io/datatypes"
"gorm.io/gorm"
)
type Client struct {
gorm.Model
ClientID string `gorm:"uniqueIndex;not null"`
ClientSecret string `gorm:"not null"`
RedirectURIs []string `gorm:"type:json"`
GrantTypes []string `gorm:"type:json"`
Scopes []string `gorm:"type:json"`
IsActive bool `gorm:"default:true"`
CreatedAt time.Time
UpdatedAt time.Time
ClientID string `gorm:"uniqueIndex;not null"`
ClientSecret string `gorm:"not null"`
RedirectURIs datatypes.JSON `gorm:"type:json"`
TokenEndpointAuthMethod string `gorm:"not null"`
GrantTypes datatypes.JSON `gorm:"type:json"`
ResponseTypes datatypes.JSON `gorm:"type:json"`
ClientName string `gorm:"type:varchar(255)"`
ClientURI string `gorm:"type:varchar(255)"`
LogoURI string `gorm:"type:varchar(255)"`
Scopes datatypes.JSON `gorm:"type:json"`
Contacts datatypes.JSON `gorm:"type:json"`
TosURI string `gorm:"type:varchar(255)"`
PolicyURI string `gorm:"type:varchar(255)"`
SoftwareID string `gorm:"type:varchar(255)"`
SoftwareVersion string `gorm:"type:varchar(255)"`
IsActive bool `gorm:"default:true"`
CreatedAt time.Time
UpdatedAt time.Time
}
func (c *Client) TableName() string {