From f17d8fc24d4342d2222d8942855495defea891a1 Mon Sep 17 00:00:00 2001 From: yongsik Date: Thu, 15 Jan 2026 14:00:55 +0900 Subject: [PATCH 01/10] =?UTF-8?q?(fix)=20monitoring=20(grafana,=20promethe?= =?UTF-8?q?us,=20loki=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +- build.gradle | 2 + .../homepage/AgencyRestController.java | 3 + .../controller/homepage/AgengyController.java | 2 + .../agency/exception/AgencyHandler.java | 8 ++ .../exception/status/AgencyErrorStatus.java | 28 ++++++ .../file/controller/FileRestController.java | 11 ++- .../domain/member/service/MemberService.java | 4 +- .../homepage/SurveyRestController.java | 90 ++++++++++++++++++- .../global/config/SecurityConfig.java | 10 +-- .../exception/GlobalExceptionHandler.java | 62 ++++++------- .../global/exception/codes/ErrorCode.java | 2 +- .../filter/AuthenticationTokenFilter.java | 4 +- .../CustomAuthenticationEntryPoint.java | 4 +- src/main/resources/logback-spring.xml | 20 +++++ .../fragments/layout/university-layout.html | 2 +- .../homepage/user/school/school-schedule.html | 1 + 17 files changed, 200 insertions(+), 56 deletions(-) create mode 100644 src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/AgencyHandler.java create mode 100644 src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/status/AgencyErrorStatus.java create mode 100644 src/main/resources/logback-spring.xml diff --git a/.gitignore b/.gitignore index 1fca2db..75452e2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,10 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ src/main/resources/application-local.yml +src/main/resources/logback-spring.xml *.env .env - +docker-compose.yml uploads ### STS ### .apt_generated diff --git a/build.gradle b/build.gradle index cc446b5..a135a26 100644 --- a/build.gradle +++ b/build.gradle @@ -66,6 +66,8 @@ dependencies { //swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.13' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'io.micrometer:micrometer-registry-prometheus' } node { diff --git a/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgencyRestController.java b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgencyRestController.java index a318251..3a1e585 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgencyRestController.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgencyRestController.java @@ -2,6 +2,7 @@ import com.cooperation.project.cooperationcenter.domain.member.dto.AgencyRegion; import com.cooperation.project.cooperationcenter.global.exception.BaseResponse; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; @@ -17,6 +18,8 @@ @RequestMapping("/api/v1/agency") @Slf4j public class AgencyRestController { + + @Operation(summary = "유학원 지역 리스트 반환") @GetMapping("/region") public BaseResponse getRegionList(){ List regions = Arrays.stream(AgencyRegion.values()) diff --git a/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgengyController.java b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgengyController.java index 8f1aa39..0a13ba4 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgengyController.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/controller/homepage/AgengyController.java @@ -2,6 +2,7 @@ import com.cooperation.project.cooperationcenter.domain.agency.dto.AgencyRequest; import com.cooperation.project.cooperationcenter.domain.agency.service.homepage.AgencyService; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.data.domain.Pageable; @@ -24,6 +25,7 @@ public class AgengyController { private final String agencyPath = "homepage/user/agency"; @RequestMapping("/list") + @Operation(summary = "해당 지역과 키워드 값을 가진 유학원 반환") public String agencyList( Model model, @PageableDefault(size = 12, sort = "createdAt", direction = Sort.Direction.DESC) diff --git a/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/AgencyHandler.java b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/AgencyHandler.java new file mode 100644 index 0000000..9cb022b --- /dev/null +++ b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/AgencyHandler.java @@ -0,0 +1,8 @@ +package com.cooperation.project.cooperationcenter.domain.agency.exception; + +import com.cooperation.project.cooperationcenter.global.exception.BaseException; +import com.cooperation.project.cooperationcenter.global.exception.codes.BaseCode; + +public class AgencyHandler extends BaseException { + public AgencyHandler(BaseCode code){super(code);} +} diff --git a/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/status/AgencyErrorStatus.java b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/status/AgencyErrorStatus.java new file mode 100644 index 0000000..759e726 --- /dev/null +++ b/src/main/java/com/cooperation/project/cooperationcenter/domain/agency/exception/status/AgencyErrorStatus.java @@ -0,0 +1,28 @@ +package com.cooperation.project.cooperationcenter.domain.agency.exception.status; + +import com.cooperation.project.cooperationcenter.global.exception.codes.BaseCode; +import com.cooperation.project.cooperationcenter.global.exception.codes.reason.Reason; +import lombok.AllArgsConstructor; +import lombok.Getter; +import org.springframework.http.HttpStatus; + +@Getter +@AllArgsConstructor +public enum AgencyErrorStatus implements BaseCode { + + AGENCY_NOT_FOUND(HttpStatus.BAD_REQUEST,"AGENCY-0001","해당 유학원은 가입 되지 않은 상태입니다. 확인 후에 다시 가입해주세요"); + + private final HttpStatus httpStatus; + private final String code; + private final String message; + + @Override + public Reason.ReasonDto getReasonHttpStatus() { + return Reason.ReasonDto.builder() + .message(message) + .code(code) + .isSuccess(false) + .httpStatus(httpStatus) + .build(); + } +} diff --git a/src/main/java/com/cooperation/project/cooperationcenter/domain/file/controller/FileRestController.java b/src/main/java/com/cooperation/project/cooperationcenter/domain/file/controller/FileRestController.java index 4cd20f7..396d088 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/domain/file/controller/FileRestController.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/domain/file/controller/FileRestController.java @@ -2,6 +2,7 @@ import com.cooperation.project.cooperationcenter.domain.file.service.FileService; import com.cooperation.project.cooperationcenter.domain.oss.OssService; +import io.swagger.v3.oas.annotations.Operation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.core.io.Resource; @@ -27,41 +28,43 @@ public class FileRestController { private final FileService fileService; private final OssService ossService; - - //note 다운로드용 @GetMapping("/{type}/{fileId}") + @Operation(summary = "파일 다운로드") public ResponseEntity downloadFile(@PathVariable String type,@PathVariable String fileId) throws MalformedURLException { log.info("enter file controller"); return fileService.loadFile(fileId,type); } - //note 이미지 뷰용 @GetMapping("/img/{type}/{fileId}") + @Operation(summary = "이미지 뷰") public ResponseEntity viewImage(@PathVariable String type,@PathVariable String fileId) throws IOException { log.info("enter file controller-img"); return fileService.viewFile(fileId,type); } - //note 이미지 뷰용 @GetMapping("/pdf/{type}/{fileId}") + @Operation(summary = "pdf새 탭으로 열기") public ResponseEntity viewPdf(@PathVariable String type, @PathVariable String fileId) throws IOException { log.info("enter file controller-img"); return fileService.viewPdf(fileId,type); } @PostMapping("/{type}") + @Operation(summary = "학교 이미지 저장") public ResponseEntity saveFile(@PathVariable String type,@RequestParam("file-0") MultipartFile file) throws IOException { log.info("save file"); return fileService.saveSchoolImgAndReturnUrl(type, file); } @GetMapping("/default/agency") + @Operation(summary = "유학원 대체 이미지") public ResponseEntity getAgencyDefaultImage(){ log.info("enter agency"); return fileService.viewDefaultImg("agency"); } @GetMapping("/default/school") + @Operation(summary = "학교 대체 이미지") public ResponseEntity getSchoolDefaultImage(){ return fileService.viewDefaultImg("school"); } diff --git a/src/main/java/com/cooperation/project/cooperationcenter/domain/member/service/MemberService.java b/src/main/java/com/cooperation/project/cooperationcenter/domain/member/service/MemberService.java index da30691..385d1e2 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/domain/member/service/MemberService.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/domain/member/service/MemberService.java @@ -1,6 +1,8 @@ package com.cooperation.project.cooperationcenter.domain.member.service; +import com.cooperation.project.cooperationcenter.domain.agency.exception.AgencyHandler; +import com.cooperation.project.cooperationcenter.domain.agency.exception.status.AgencyErrorStatus; import com.cooperation.project.cooperationcenter.domain.agency.model.Agency; import com.cooperation.project.cooperationcenter.domain.agency.repository.AgencyRepository; import com.cooperation.project.cooperationcenter.domain.file.dto.FileAttachmentDto; @@ -97,7 +99,7 @@ public void signup(String memberData,String agencyData, MultipartFile agencyPict private Agency checkAgency(MemberRequest.SignupExistingAgencyDto agencyDto){ return agencyRepository.findAgencyByAgencyNameAndAgencyEmailAndShare(agencyDto.agencyName(),agencyDto.agencyEmail(),true).orElseThrow( - () -> new BaseException(ErrorCode.AGENCY_NOT_FOUND) + () -> new AgencyHandler(AgencyErrorStatus.AGENCY_NOT_FOUND) ); } diff --git a/src/main/java/com/cooperation/project/cooperationcenter/domain/survey/controller/homepage/SurveyRestController.java b/src/main/java/com/cooperation/project/cooperationcenter/domain/survey/controller/homepage/SurveyRestController.java index fa2dbf6..e27b8ed 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/domain/survey/controller/homepage/SurveyRestController.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/domain/survey/controller/homepage/SurveyRestController.java @@ -8,6 +8,7 @@ import com.cooperation.project.cooperationcenter.global.exception.BaseResponse; import com.fasterxml.jackson.core.JsonProcessingException; import com.google.zxing.WriterException; +import io.swagger.v3.oas.annotations.Operation; import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -37,9 +38,13 @@ public class SurveyRestController { private final SurveyQRService surveyQRService; private final SurveyFolderService surveyFolderService; - - //Note 설문조사 보여주는 controller - + @Operation( + summary = "설문 목록 조회", + description = """ + 페이지네이션 및 조건(title, surveyType)을 기반으로 + 설문 목록을 조회합니다. + """ + ) @GetMapping("/list") public BaseResponse getSurveyList(@PageableDefault(size = 9, sort = "createdAt", direction = Sort.Direction.DESC) Pageable pageable, @@ -49,6 +54,13 @@ public BaseResponse getSurveyList(@PageableDefault(size = 9, sort = "createdA return BaseResponse.onSuccess(surveyFindService.getFilteredSurveysAll(pageable,new SurveyRequest.LogFilterDto(title,null,null,Survey.SurveyType.getSruveyType(surveyType)),null)); } + @Operation( + summary = "설문 상세 조회", + description = """ + 설문 ID를 기반으로 설문 제목, 설명, 질문 목록을 조회합니다. + 설문 참여 화면에서 사용됩니다. + """ + ) @GetMapping("/{surveyId}") public BaseResponse getSurvey(@PathVariable String surveyId){ log.info("[controller] getSurvey 진입 : {}",surveyId); @@ -56,6 +68,13 @@ public BaseResponse getSurvey(@PathVariable String surveyId){ return BaseResponse.onSuccess(surveySaveService.getSurveys(surveyId)); } + @Operation( + summary = "설문 생성", + description = """ + 질문 목록을 포함한 새로운 설문을 생성합니다. + 관리자 페이지에서 설문 작성 시 사용됩니다. + """ + ) @PostMapping("/admin/make") public BaseResponse saveSurvey(@RequestBody SurveyRequest.SurveyDto request){ log.info("[controller] {}",request.toString()); @@ -63,6 +82,13 @@ public BaseResponse saveSurvey(@RequestBody SurveyRequest.SurveyDto request){ return BaseResponse.onSuccess("success"); } + @Operation( + summary = "설문 삭제", + description = """ + 설문 ID를 기준으로 설문을 삭제합니다. + 삭제된 설문은 복구할 수 없습니다. + """ + ) @DeleteMapping("/admin/{surveyId}") public BaseResponse deleteSurvey(@PathVariable String surveyId){ log.info("[controller] getSurvey 진입 : {}",surveyId); @@ -70,6 +96,13 @@ public BaseResponse deleteSurvey(@PathVariable String surveyId){ return BaseResponse.onSuccess("success"); } + @Operation( + summary = "설문 복사", + description = """ + 기존 설문을 복사하여 새로운 설문으로 생성합니다. + 질문 구성과 설정이 함께 복사됩니다. + """ + ) @PostMapping("/admin/copy/{surveyId}") public BaseResponse copySurvey(@PathVariable String surveyId){ log.info("[controller] getSurvey 진입 : {}",surveyId); @@ -78,6 +111,12 @@ public BaseResponse copySurvey(@PathVariable String surveyId){ } + @Operation( + summary = "설문 수정", + description = """ + 기존 설문의 제목, 설명, 질문 정보를 수정합니다. + """ + ) @PatchMapping("/admin/edit") public BaseResponse editSurvey(@RequestBody SurveyEditDto request){ log.info("[controller] getSurvey 진입 : {}",request.surveyId()); @@ -88,6 +127,13 @@ public BaseResponse editSurvey(@RequestBody SurveyEditDto request){ //note 설문조사 답변 및 로그 확인 + @Operation( + summary = "설문 응답 제출", + description = """ + 사용자가 작성한 설문 응답 데이터를 서버에 제출합니다. + 제출된 응답은 설문 통계 및 응답 로그로 저장됩니다. + """ + ) @PostMapping("/answer") public BaseResponse receiveSurveyAnswer( @RequestPart("data") String data, @@ -141,6 +187,13 @@ public ResponseEntity extractFileSurvey(@PathVariable Str return surveyLogService.extractFileSurvey(surveyId); } + @Operation( + summary = "설문 QR 코드 생성", + description = """ + 설문 접근 URL을 기반으로 QR 코드 데이터를 생성합니다. + 오프라인 배포용으로 사용됩니다. + """ + ) @GetMapping("/qr") public Object cerateQR(@RequestParam String url,HttpServletRequest request) throws WriterException, IOException { log.info("url:{}",url); @@ -150,29 +203,60 @@ public Object cerateQR(@RequestParam String url,HttpServletRequest request) thro .body(Qr); } + @Operation( + summary = "설문 템플릿 조회", + description = """ + 설문 타입에 따라 미리 정의된 기본 질문 템플릿을 조회합니다. + """ + ) @GetMapping("/admin/template") public BaseResponse getTemplate(@RequestParam("type") String type){ log.info("enter controller type:{}",type); return BaseResponse.onSuccess(surveySaveService.getTemplate(type)); } + @Operation( + summary = "설문 폴더 목록 조회", + description = """ + 관리자가 생성한 설문 폴더 목록을 조회합니다. + """ + ) @GetMapping("/admin/folders") public BaseResponse getFolders(){ return BaseResponse.onSuccess(surveyFolderService.getSurveyFolderDtos()); } + @Operation( + summary = "설문 폴더 생성", + description = """ + 설문을 분류하기 위한 새로운 폴더를 생성합니다. + """ + ) @PostMapping("/admin/folders") public BaseResponse makeFolder(@RequestBody SurveyFolderDto request,@AuthenticationPrincipal MemberDetails memberDetails){ surveyFolderService.saveSurveyFolderDto(request,memberDetails); return BaseResponse.onSuccess("success"); } + @Operation( + summary = "설문 폴더 수정", + description = """ + 설문 폴더의 이름 또는 정보를 수정합니다. + """ + ) @PatchMapping("/admin/folders/{folderId}") public BaseResponse updateFolder(@RequestBody SurveyFolderDto request){ surveyFolderService.updateSurveyFolderDto(request); return BaseResponse.onSuccess("success"); } + @Operation( + summary = "설문 폴더 삭제", + description = """ + 설문 폴더를 삭제합니다. + 폴더 내 설문은 삭제되지 않습니다. + """ + ) @DeleteMapping("/admin/folders/{folderId}") public BaseResponse deleteFolder(@PathVariable String folderId){ surveyFolderService.deleteSurveyFolder(folderId); diff --git a/src/main/java/com/cooperation/project/cooperationcenter/global/config/SecurityConfig.java b/src/main/java/com/cooperation/project/cooperationcenter/global/config/SecurityConfig.java index 7cac7ce..25667e1 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/global/config/SecurityConfig.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/global/config/SecurityConfig.java @@ -46,11 +46,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{ //note static 해제 .requestMatchers("/css/**","/plugins/**","/js/**").permitAll() //fixme 임시용임 밑에는 - .requestMatchers("/v3/**", - "/swagger-ui.html", - "/swagger-ui/**", - "/swagger-resources/**", - "/api-test/**").permitAll() + .requestMatchers("/v3/**", "/swagger-ui.html", "/swagger-ui/**", + "/swagger-resources/**", "/api-test/**","/api-test").permitAll() //note 일반 사용자 페이지 .requestMatchers("/","/home", "/member/signup","/member/login", @@ -60,8 +57,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception{ .requestMatchers("/check/**","/member/password/**","/api/v1/member/reset/**").permitAll() .requestMatchers("/api/v1/tencent/**","/api/v1/agency/region").permitAll() .requestMatchers("/api/v1/admin/login").permitAll() - - + .requestMatchers("/actuator/**","/actuator","/error").permitAll() //note 로그인한 사용자 .requestMatchers("/survey/log/detail/**").authenticated() diff --git a/src/main/java/com/cooperation/project/cooperationcenter/global/exception/GlobalExceptionHandler.java b/src/main/java/com/cooperation/project/cooperationcenter/global/exception/GlobalExceptionHandler.java index b6d5496..dfb4068 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/global/exception/GlobalExceptionHandler.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/global/exception/GlobalExceptionHandler.java @@ -1,40 +1,32 @@ -package com.cooperation.project.cooperationcenter.global.exception; - -import com.cooperation.project.cooperationcenter.global.exception.codes.ErrorCode; -import com.cooperation.project.cooperationcenter.global.exception.codes.reason.Reason; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -@RestControllerAdvice -@Slf4j -public class GlobalExceptionHandler { - +//package com.cooperation.project.cooperationcenter.global.exception; +// +//import com.cooperation.project.cooperationcenter.global.exception.codes.ErrorCode; +//import com.cooperation.project.cooperationcenter.global.exception.codes.reason.Reason; +//import lombok.extern.slf4j.Slf4j; +//import org.springframework.http.HttpStatus; +//import org.springframework.http.ResponseEntity; +//import org.springframework.web.bind.annotation.ExceptionHandler; +//import org.springframework.web.bind.annotation.RestControllerAdvice; +// +//@RestControllerAdvice +//@Slf4j +//public class GlobalExceptionHandler { +// // @ExceptionHandler(BaseException.class) -// public ResponseEntity> handleBaseException(BaseException e) { +// public BaseResponse handleBaseException(BaseException e) { // Reason.ReasonDto reason = e.getErrorReasonHttpStatus(); // log.info("baseResponse:{}",BaseResponse.onFailure(reason.getCode(), reason.getMessage(), null).toString()); +// return BaseResponse.onFailure(reason.getCode(), reason.getMessage(), null); +// } +// +// @ExceptionHandler(Exception.class) +// public ResponseEntity> handleOther(Exception ex) { // return ResponseEntity -// .status(reason.getHttpStatus()) -// .body(BaseResponse.onFailure(reason.getCode(), reason.getMessage(), null)); +// .status(HttpStatus.INTERNAL_SERVER_ERROR) +// .body(BaseResponse.onFailure( +// ErrorCode.INTERNAL_SERVER_ERROR.getCode(), +// ErrorCode.INTERNAL_SERVER_ERROR.getMessage(), +// null +// )); // } - @ExceptionHandler(BaseException.class) - public BaseResponse handleBaseException(BaseException e) { - Reason.ReasonDto reason = e.getErrorReasonHttpStatus(); - log.info("baseResponse:{}",BaseResponse.onFailure(reason.getCode(), reason.getMessage(), null).toString()); - return BaseResponse.onFailure(reason.getCode(), reason.getMessage(), null); - } - - @ExceptionHandler(Exception.class) - public ResponseEntity> handleOther(Exception ex) { - return ResponseEntity - .status(HttpStatus.INTERNAL_SERVER_ERROR) - .body(BaseResponse.onFailure( - ErrorCode.INTERNAL_SERVER_ERROR.getCode(), - ErrorCode.INTERNAL_SERVER_ERROR.getMessage(), - null - )); - } -} +//} diff --git a/src/main/java/com/cooperation/project/cooperationcenter/global/exception/codes/ErrorCode.java b/src/main/java/com/cooperation/project/cooperationcenter/global/exception/codes/ErrorCode.java index bd650ba..da3a299 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/global/exception/codes/ErrorCode.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/global/exception/codes/ErrorCode.java @@ -100,7 +100,7 @@ public enum ErrorCode implements BaseCode { SURVEY_DATE_NOT_VALID(HttpStatus.BAD_REQUEST,"SURVEY-0000","지금 설문조사 입력 기간이 아닙니다."), SURVEY_NOT_SHARE(HttpStatus.BAD_REQUEST,"SURVEY-0001","해당 설문조사는 공개 전입니다."), - AGENCY_NOT_FOUND(HttpStatus.BAD_REQUEST,"AGENCY-0001","해당 유학원은 가입 되지 않은 상태입니다. 확인 후에 다시 가입해주세요"), + // 5xx : server error INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "SERVER-0000", "서버 에러"); diff --git a/src/main/java/com/cooperation/project/cooperationcenter/global/filter/AuthenticationTokenFilter.java b/src/main/java/com/cooperation/project/cooperationcenter/global/filter/AuthenticationTokenFilter.java index 3a1819c..b52d8be 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/global/filter/AuthenticationTokenFilter.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/global/filter/AuthenticationTokenFilter.java @@ -49,12 +49,12 @@ protected void doFilterInternal(HttpServletRequest request, //note 무시하는 endpoint들 final String[] IGNORE_PATHS = { "/css", "/js", "/plugins","/member/logout","/member/signup","/api/v1/member","api/v1/school", - "/api/v1/admin","/api/v1/file/img","/admin/login", "/static/favicon.ico","/api/v1/tencent","/favicon.ico","/api/v1/agency" -// ,"/member/login" + "/api/v1/admin","/api/v1/file/img","/admin/login", "/static/favicon.ico","/api/v1/tencent","/favicon.ico","/api/v1/agency","/actuator" }; for (String allowed : IGNORE_PATHS) { if (path.startsWith(allowed)) { + log.info("무시 path:{}",allowed); filterChain.doFilter(request, response); return; } diff --git a/src/main/java/com/cooperation/project/cooperationcenter/global/filter/CustomAuthenticationEntryPoint.java b/src/main/java/com/cooperation/project/cooperationcenter/global/filter/CustomAuthenticationEntryPoint.java index afbced4..4f88cd9 100644 --- a/src/main/java/com/cooperation/project/cooperationcenter/global/filter/CustomAuthenticationEntryPoint.java +++ b/src/main/java/com/cooperation/project/cooperationcenter/global/filter/CustomAuthenticationEntryPoint.java @@ -2,6 +2,7 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; @@ -9,6 +10,7 @@ import java.io.IOException; @Component +@Slf4j public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint { //Authentication예외 상황일 때 로그인 페이지로 보내기 위함. @@ -18,7 +20,7 @@ public void commence(HttpServletRequest request, AuthenticationException authException) throws IOException { String uri = request.getRequestURI(); - + log.info("custom Authen path:{}",uri); if (uri.startsWith("/admin")) { response.sendRedirect("/admin/login"); } else{ diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..1ad0bbf --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,20 @@ + + + + + + + + + + ${PATTERN} + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/fragments/layout/university-layout.html b/src/main/resources/templates/fragments/layout/university-layout.html index 18ab631..eadfa65 100644 --- a/src/main/resources/templates/fragments/layout/university-layout.html +++ b/src/main/resources/templates/fragments/layout/university-layout.html @@ -128,7 +128,7 @@ -
+
diff --git a/src/main/resources/templates/homepage/user/school/school-schedule.html b/src/main/resources/templates/homepage/user/school/school-schedule.html index 2a04755..bfd087d 100644 --- a/src/main/resources/templates/homepage/user/school/school-schedule.html +++ b/src/main/resources/templates/homepage/user/school/school-schedule.html @@ -3,6 +3,7 @@ th:replace="~{fragments/layout/university-layout :: university-layout(~{::head}, ~{::main}, ~{::script})}"> 国际项目 - 校历 +