|
|
@@ -45,15 +45,15 @@ public class UserKeyService {
|
|
|
}
|
|
|
|
|
|
public Result auth(KeyAuthDto keyAuthDto) {
|
|
|
- int loginUser = UserContext.getUserId();
|
|
|
- UserKey userKey = userKeyRepository.findByCreateBy(loginUser);
|
|
|
+ String accessKeyId = keyAuthDto.getAccessKeyId();
|
|
|
+ UserKey userKey = userKeyRepository.findByAccessKeyId(accessKeyId);
|
|
|
if (userKey == null) {
|
|
|
return Result.fail("key not exist");
|
|
|
}
|
|
|
|
|
|
- String accessKeyId = keyAuthDto.getAccessKeyId();
|
|
|
String accessKeySecret = keyAuthDto.getAccessKeySecret();
|
|
|
- if (userKey.getAccessKeyId().equals(accessKeyId) && userKey.getAccessKeySecret().equals(accessKeySecret)) {
|
|
|
+ if (userKey.getAccessKeySecret().equals(accessKeySecret)) {
|
|
|
+ int loginUser = userKey.getCreateBy();
|
|
|
String token = getTokenByUserId(loginUser);
|
|
|
return Result.success(token);
|
|
|
}
|