Skip to content

Commit

Permalink
Merge pull request #107 from KAKAO-TOUR-API-CONTEST/develop
Browse files Browse the repository at this point in the history
token validation
  • Loading branch information
femmefatalehaein authored Sep 29, 2024
2 parents 0ef5a84 + fb3c502 commit d94db3e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/main/java/com/example/ai_jeju/controller/TokenController.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ public TokenController(TokenProvider tokenProvider) {
}

@GetMapping("")
public ResponseDto getMyTokenInfo(@RequestHeader("") String token) {
public ResponseDto getMyTokenInfo(@RequestHeader("custom") String token) {
// Bearer 토큰 형식에서 "Bearer " 부분 제거
String accessToken = token.replace("Bearer ", "");
Date expiredDate = tokenProvider.getExpiredDate(token);
// 날짜 포맷 지정 (예: yyyy-MM-dd HH:mm:ss)
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

// Date를 String으로 변환
String dateString = formatter.format(expiredDate);
if (tokenProvider.validToken(token)) {
if (tokenProvider.validToken(accessToken)) {

Date expiredDate = tokenProvider.getExpiredDate(accessToken);
// 날짜 포맷 지정 (예: yyyy-MM-dd HH:mm:ss)
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(expiredDate);

return ResponseUtil.SUCCESS(true,dateString);
} else {

return ResponseUtil.ERROR(false, null);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ public MainResponse getMain(FilterDto filterDto, Long userId, int randomSeed, in
public MainResponse getMain(FilterDto filterDto, int randomSeed, int page){

Map<String, Object> result =storeRepositoryCustom.findByFilterDto(filterDto, randomSeed,page);

List<MainListResponse> mainListResponses = new ArrayList<>();

List<Store> stores = (List<Store>) result.get("stores");

for(Store store : stores){
Expand Down

0 comments on commit d94db3e

Please sign in to comment.