GenerateTokenAes 获取JwtSecretLen

This commit is contained in:
zhaoxiaorong 2025-02-11 11:56:48 +08:00
parent d8e54f4909
commit 8d8ec866cd
1 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,8 @@ func New(token string) {
}
func GenerateTokenAes(id uint, identity, client, role string, owner any, extend map[string]string) (string, error) {
if (JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32) == false {
JwtSecretLen = len(env.Runtime.JwtSecretKey)
if JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32 {
return "", errcode.ErrJWTSecretKey
}
expireTime := time.Now().Add(vars.JwtExpireDay)