@@ -41,9 +41,12 @@ export default class TokenUtils {
tokenExpiresIn,
tokenExpiresThreshold
}=this.config
if(tokenExpiresThreshold>tokenExpiresIn){
if(tokenExpiresThreshold>=tokenExpiresIn){
thrownewError('Config error, tokenExpiresThreshold should be less than tokenExpiresIn')
}
if(tokenExpiresThreshold>tokenExpiresIn/2){
console.warn(`Please check whether the tokenExpiresThreshold configuration is set too large, tokenExpiresThreshold: ${tokenExpiresThreshold}, tokenExpiresIn: ${tokenExpiresIn}`)
}
}
getcustomToken(){
...
...
@@ -193,7 +196,8 @@ export default class TokenUtils {
constnow=Date.now()
const{
tokenSecret,
tokenExpiresIn
tokenExpiresIn,
maxTokenLength=10
}=this.config
consttoken=jwt.sign({
...signContent,
...
...
@@ -219,6 +223,10 @@ export default class TokenUtils {