优化token密钥生成逻辑
This commit is contained in:
parent
87a01e1292
commit
d0752ebe9c
@ -40,8 +40,12 @@ class BaseConfig(
|
||||
/**
|
||||
* JWT密钥
|
||||
*/
|
||||
secret: String = numberToKey(Date().time).repeat(5),
|
||||
secret: String,
|
||||
) {
|
||||
val secretKey: SecretKey = Keys.hmacShaKeyFor(secret.toByteArray())
|
||||
val secretKey: SecretKey = Keys.hmacShaKeyFor(if (secret.isBlank()) {
|
||||
numberToKey(Date().time).repeat(10).toByteArray().apply { shuffle() }
|
||||
} else {
|
||||
secret.toByteArray()
|
||||
})
|
||||
val whiteList: List<Regex> = whiteList.map { it.toRegex() }
|
||||
}
|
Loading…
Reference in New Issue
Block a user