重构错误处理逻辑,使用 fiber.Error 统一返回错误状态码;统一授权枚举值定义到 auth 包

This commit is contained in:
2025-05-10 13:38:47 +08:00
parent a06655ad29
commit 3140d35a95
9 changed files with 103 additions and 94 deletions

18
web/auth/authorize.go Normal file
View File

@@ -0,0 +1,18 @@
package auth
type GrantType string
const (
GrantAuthorizationCode = GrantType("authorization_code") // 授权码模式
GrantClientCredentials = GrantType("client_credentials") // 客户端凭证模式
GrantRefreshToken = GrantType("refresh_token") // 刷新令牌模式
GrantPassword = GrantType("password") // 密码模式(私有扩展)
)
type PasswordGrantType string
const (
GrantPasswordSecret = PasswordGrantType("password") // 密码模式
GrantPasswordPhone = PasswordGrantType("phone_code") // 手机号模式
GrantPasswordEmail = PasswordGrantType("email_code") // 邮箱模式
)