Merge pull request 'test api 추가, 개발서버 토큰 만료시간 조정' (#48) from feat/dev_251201 into develop
Reviewed-on: https://kamco.gitea.gs.dabeeo.com/dabeeo/kamco-dabeeo-backoffice/pulls/48
This commit is contained in:
@@ -6,8 +6,6 @@ import org.springframework.http.HttpStatus;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum AuthErrorCode implements ErrorCode {
|
public enum AuthErrorCode implements ErrorCode {
|
||||||
|
|
||||||
// 🔐 로그인 관련
|
|
||||||
LOGIN_ID_NOT_FOUND("LOGIN_ID_NOT_FOUND", HttpStatus.UNAUTHORIZED),
|
LOGIN_ID_NOT_FOUND("LOGIN_ID_NOT_FOUND", HttpStatus.UNAUTHORIZED),
|
||||||
|
|
||||||
LOGIN_PASSWORD_MISMATCH("LOGIN_PASSWORD_MISMATCH", HttpStatus.UNAUTHORIZED),
|
LOGIN_PASSWORD_MISMATCH("LOGIN_PASSWORD_MISMATCH", HttpStatus.UNAUTHORIZED),
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ public class HtmlEscapeDeserializer extends JsonDeserializer<Object> {
|
|||||||
public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
|
public Object deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
|
||||||
throws IOException, JacksonException {
|
throws IOException, JacksonException {
|
||||||
String value = jsonParser.getValueAsString();
|
String value = jsonParser.getValueAsString();
|
||||||
System.out.println("🔥 HtmlEscapeDeserializer 실행됨: " + value);
|
|
||||||
System.out.println("convert : " + (value == null ? null : HtmlUtils.htmlEscape(value)));
|
|
||||||
return value == null ? null : HtmlUtils.htmlEscape(value);
|
return value == null ? null : HtmlUtils.htmlEscape(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class AuthController {
|
|||||||
description = "재발급 성공",
|
description = "재발급 성공",
|
||||||
content = @Content(schema = @Schema(implementation = TokenResponse.class))),
|
content = @Content(schema = @Schema(implementation = TokenResponse.class))),
|
||||||
@ApiResponse(
|
@ApiResponse(
|
||||||
responseCode = "401",
|
responseCode = "403",
|
||||||
description = "만료되었거나 유효하지 않은 리프레시 토큰",
|
description = "만료되었거나 유효하지 않은 리프레시 토큰",
|
||||||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
|
||||||
})
|
})
|
||||||
@@ -166,7 +166,6 @@ public class AuthController {
|
|||||||
if (refreshToken == null || !jwtTokenProvider.isValidToken(refreshToken)) {
|
if (refreshToken == null || !jwtTokenProvider.isValidToken(refreshToken)) {
|
||||||
throw new AccessDeniedException("만료되었거나 유효하지 않은 리프레시 토큰 입니다.");
|
throw new AccessDeniedException("만료되었거나 유효하지 않은 리프레시 토큰 입니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
String username = jwtTokenProvider.getSubject(refreshToken);
|
String username = jwtTokenProvider.getSubject(refreshToken);
|
||||||
|
|
||||||
// Redis에 저장된 RefreshToken과 일치하는지 확인
|
// Redis에 저장된 RefreshToken과 일치하는지 확인
|
||||||
|
|||||||
@@ -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.";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,8 +38,10 @@ spring:
|
|||||||
|
|
||||||
jwt:
|
jwt:
|
||||||
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
|
secret: "kamco_token_9b71e778-19a3-4c1d-97bf-2d687de17d5b"
|
||||||
access-token-validity-in-ms: 86400000 # 1일
|
#access-token-validity-in-ms: 86400000 # 1일
|
||||||
refresh-token-validity-in-ms: 604800000 # 7일
|
#refresh-token-validity-in-ms: 604800000 # 7일
|
||||||
|
access-token-validity-in-ms: 60000 # 1분
|
||||||
|
refresh-token-validity-in-ms: 300000 # 5분
|
||||||
|
|
||||||
token:
|
token:
|
||||||
refresh-cookie-name: kamco-dev # 개발용 쿠키 이름
|
refresh-cookie-name: kamco-dev # 개발용 쿠키 이름
|
||||||
|
|||||||
Reference in New Issue
Block a user