fix authentication

This commit is contained in:
dirgantarasiahaan
2023-05-25 14:54:43 +07:00
parent d50b2a8eef
commit c833f09200
8 changed files with 17 additions and 16 deletions

View File

@ -27,7 +27,7 @@ public class PostCheckAccessTokenService implements BaseService<PostAccessTokenR
public PostAccessTokenResponse execute(PostAccessTokenRequest input) {
var decodeToken = TokenUtils.decodeToken(input.getAccessToken());
String userId = decodeToken.get("user_id");
Long userId = Long.valueOf(decodeToken.get("user_id"));
List<TokenManagementView> tokenManagementViews = tokenManagementRepository.findAccessTokenByUserIdAndDeletedFalse(userId);
if (tokenManagementViews.isEmpty()) {
@ -38,7 +38,7 @@ public class PostCheckAccessTokenService implements BaseService<PostAccessTokenR
}
List<String> userTokenList = tokenManagementViews.stream()
.map(c-> CommonUtil.clobToString(c.getAccessToken()))
.map(TokenManagementView::getAccessToken)
.collect(Collectors.toList());
boolean isMatch = userTokenList.stream().anyMatch(s -> s.equals(input.getAccessToken()));