🎨jwt密钥增加随机性
This commit is contained in:
parent
1fa56c68dd
commit
11d649cfc3
@ -103,7 +103,8 @@ func (JwtComponent) ParseToken(token, secret string) (*JwtComponent, error) {
|
|||||||
func (JwtComponent) GenerateSecret(secret ...string) string {
|
func (JwtComponent) GenerateSecret(secret ...string) string {
|
||||||
// 添加10个元素,增加随机性
|
// 添加10个元素,增加随机性
|
||||||
for i := 0; i <= 10; i++ {
|
for i := 0; i <= 10; i++ {
|
||||||
secret = append(secret, uuid.NewString()
|
secret = append(secret, uuid.NewString())
|
||||||
|
}
|
||||||
// 混淆一下明文secret的顺序
|
// 混淆一下明文secret的顺序
|
||||||
n := len(secret)
|
n := len(secret)
|
||||||
for i := n - 1; i > 0; i-- {
|
for i := n - 1; i > 0; i-- {
|
||||||
|
Loading…
Reference in New Issue
Block a user