更新依赖项,添加单元测试,优化用户信息和令牌管理功能,增强中间件以支持 JWT 验证,新增访问令牌模型并更新数据库迁移。

This commit is contained in:
2025-04-17 02:04:52 +08:00
parent 83c82f7135
commit d06e45e5d4
10 changed files with 482 additions and 14 deletions

View File

@@ -2,7 +2,6 @@ package handlers
import (
"crypto/rsa"
"fmt"
"net/http"
"net/url"
"strings"
@@ -154,7 +153,7 @@ func (h *OIDCHandler) Userinfo(c *gin.Context) {
// 准备返回的声明
claims := gin.H{
"sub": fmt.Sprintf("%d", user.ID),
"sub": user.Username,
}
// 根据授权范围添加相应的声明
@@ -164,6 +163,7 @@ func (h *OIDCHandler) Userinfo(c *gin.Context) {
claims["name"] = user.Username
case "email":
claims["email"] = user.Email
claims["email_verified"] = true
}
}