chore: 清理 JWT 向后兼容残留,移除全部死代码
- 删除 5 个空壳占位文件:auth_token.go/auth_parser.go/repository.go(middleware)/token_service.go/provider.go - 移除 Config.JWT 字段、JWTConfig 结构体、JWT_SECRET 环境变量绑定 - 移除 config.yaml 中的 jwt 配置段 - 移除 model.User.TokenVersion 字段(session DestroyByUID 替代) - 移除 service/repository.go 中已废弃的 userTokenStore 接口
This commit is contained in:
@ -13,7 +13,6 @@ import (
|
||||
type Config struct {
|
||||
Server ServerConfig `mapstructure:"server"`
|
||||
Database DatabaseConfig `mapstructure:"database"`
|
||||
JWT JWTConfig `mapstructure:"jwt"`
|
||||
Session SessionConfig `mapstructure:"session"`
|
||||
Bcrypt BcryptConfig `mapstructure:"bcrypt"`
|
||||
Roles RolesConfig `mapstructure:"roles"`
|
||||
@ -42,11 +41,7 @@ type DatabaseConfig struct {
|
||||
SSLMode string `mapstructure:"sslmode"`
|
||||
}
|
||||
|
||||
type JWTConfig struct {
|
||||
Secret string `mapstructure:"secret"`
|
||||
}
|
||||
|
||||
// SessionConfig 服务端会话配置(替换 JWT 无状态认证)
|
||||
// SessionConfig 服务端会话配置
|
||||
type SessionConfig struct {
|
||||
IdleTimeout int `mapstructure:"idle_timeout"` // 不记住我:空闲超时(分钟),默认 1440(24小时)
|
||||
RememberTimeout int `mapstructure:"remember_timeout"` // 记住我:空闲超时(分钟),默认 43200(30天)
|
||||
@ -132,7 +127,6 @@ func loadEnvFile(path string) {
|
||||
// bindEnvOverride 将环境变量映射到 config 的嵌套键
|
||||
func bindEnvOverride(v *viper.Viper) {
|
||||
_ = v.BindEnv("database.password", "DATABASE_PASSWORD")
|
||||
_ = v.BindEnv("jwt.secret", "JWT_SECRET")
|
||||
}
|
||||
|
||||
// DSN 返回 PostgreSQL 连接字符串
|
||||
|
||||
Reference in New Issue
Block a user