test api 추가, 개발서버 토큰 만료시간 조정

This commit is contained in:
2025-12-11 17:06:13 +09:00
parent 7cc8e46056
commit d18e4db060
4 changed files with 284 additions and 212 deletions

View File

@@ -157,7 +157,7 @@ public class AuthController {
description = "재발급 성공",
content = @Content(schema = @Schema(implementation = TokenResponse.class))),
@ApiResponse(
responseCode = "401",
responseCode = "403",
description = "만료되었거나 유효하지 않은 리프레시 토큰",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@@ -166,7 +166,6 @@ public class AuthController {
if (refreshToken == null || !jwtTokenProvider.isValidToken(refreshToken)) {
throw new AccessDeniedException("만료되었거나 유효하지 않은 리프레시 토큰 입니다.");
}
String username = jwtTokenProvider.getSubject(refreshToken);
// Redis에 저장된 RefreshToken과 일치하는지 확인

View File

@@ -146,6 +146,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
return content;
}
/**
* 분석결과 상세 class name별 탐지 개수
*
@@ -311,7 +312,9 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
.fetch();
}
/** Pageable의 Sort를 QueryDSL OrderSpecifier로 변환 */
/**
* Pageable의 Sort를 QueryDSL OrderSpecifier로 변환
*/
@SuppressWarnings({"unchecked", "rawtypes"})
private List<OrderSpecifier<?>> getOrderSpecifiers(Sort sort) {
List<OrderSpecifier<?>> orders = new ArrayList<>();
@@ -326,8 +329,7 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
// 유효한 필드만 처리
switch (property) {
case "classBeforeCd" -> orders.add(new OrderSpecifier(direction, entity.classBeforeCd));
case "classBeforeProb" ->
orders.add(new OrderSpecifier(direction, entity.classBeforeProb));
case "classBeforeProb" -> orders.add(new OrderSpecifier(direction, entity.classBeforeProb));
case "classAfterCd" -> orders.add(new OrderSpecifier(direction, entity.classAfterCd));
case "classAfterProb" -> orders.add(new OrderSpecifier(direction, entity.classAfterProb));
case "mapSheetNum" -> orders.add(new OrderSpecifier(direction, entity.mapSheetNum));
@@ -337,7 +339,8 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC
case "createdDttm" -> orders.add(new OrderSpecifier(direction, entity.createdDttm));
case "updatedDttm" -> orders.add(new OrderSpecifier(direction, entity.updatedDttm));
// 유효하지 않은 필드는 무시
default -> {}
default -> {
}
}
}
}

View File

@@ -0,0 +1,68 @@
package com.kamco.cd.kamcoback.test;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.ErrorResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "test api", description = "test api")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/test")
public class TestApiController {
@Operation(summary = "admin test", description = "admin test api")
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "조회",
content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(
responseCode = "403",
description = "권한 없음",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@GetMapping("/admin")
public String admin() {
return "I am administrator";
}
@Operation(summary = "label test", description = "label test api")
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "조회",
content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(
responseCode = "403",
description = "권한 없음",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@GetMapping("/label")
public String label() {
return "Labeling is available.";
}
@Operation(summary = "review test", description = "review test api")
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "조회",
content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(
responseCode = "403",
description = "권한 없음",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@GetMapping("/review")
public String review() {
return "Review is available.";
}
}

View File

@@ -38,8 +38,10 @@ spring:
jwt:
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
access-token-validity-in-ms: 86400000 # 1일
refresh-token-validity-in-ms: 604800000 # 7일
#access-token-validity-in-ms: 86400000 # 1일
#refresh-token-validity-in-ms: 604800000 # 7일
access-token-validity-in-ms: 60000 # 1분
refresh-token-validity-in-ms: 300000 # 5분
token:
refresh-cookie-name: kamco-dev # 개발용 쿠키 이름