java - AWT 令牌生成类似令牌
问题描述
为什么当我发出以每 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 毫秒内发出新令牌,则返回相同的令牌
解决方案
Since you aren't changing anything else, the issued time probably isn't measured down below a second by default.
I would add a token uuid to each token to differentiate the generated token string.
推荐阅读
- ios - 使用 Picker View 过滤 CollectionView
- swift - 在 Swift 中结束 CAEmitterLayer 的正确方法是什么?
- azure-devops - 谷歌容器生成器任务找不到 gcloud
- python - 在python中输入直到文件结尾
- java - Android Studio 构建 APK 失败
- python - Wand 未正确设置 Jpeg 图像分辨率
- google-maps - 按照官方步骤为新项目生成谷歌地图API,无法加载到谷歌云平台
- go - 在另一个文件中公开结构
- mysql - 在 mySQL 查询中使用条件
- django - 为什么 m2m 的 add() 方法不适用于单个对象 - django