AWT令牌生成类似令牌

时间:2018-09-04 16:05:26

标签: java spring spring-security jwt

为什么当我发出每10毫秒生成一个新令牌时,算法会返回相同的令牌

// generate a token every 10ms        

@Scheduled(fixedRate=10)
public void work() {
    // get user information
    UserProfile newuser = new UserProfile("abc", "abc123");

    //generate the token 
    String jwt = tokenProvider.generateToken(newuser);

    // print the token                           
    System.out.println(jwt);
}

如果我在不到1000毫秒的时间内发出新令牌,则会返回相同的令牌

1 个答案:

答案 0 :(得分:0)

由于您没有进行任何其他更改,因此默认情况下可能不会将发布时间缩短到一秒钟以下。

我会在每个令牌中添加一个令牌uuid来区分生成的令牌字符串。

相关问题