Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions back/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ dependencies {
implementation ("org.springframework.kafka:spring-kafka")

runtimeOnly("com.mysql:mysql-connector-j")

// Sentry
implementation("io.sentry:sentry-spring-boot-starter-jakarta:8.19.1")
}

tasks.withType<Test> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.back.global.rq.Rq;
import com.back.global.rsData.RsData;
import com.back.standard.util.Ut;
import io.sentry.Sentry;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
Expand All @@ -14,6 +15,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;
Expand All @@ -36,8 +38,9 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse

try {
work(request, response, filterChain);
} catch (Exception e) {
} catch (AuthenticationException e) {
log.error("CustomAuthenticationFilter에서 예외 발생: ",e); //401 에러로 빠지는거 추적 가능
Sentry.captureException(e);
RsData<Void> rsData = new RsData<>("401-1", "인증 오류가 발생했습니다.");
response.setContentType("application/json;charset=UTF-8");
response.setStatus(rsData.statusCode());
Expand Down
6 changes: 6 additions & 0 deletions back/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ server:
port: 8080
forward-headers-strategy: native

sentry:
dsn: https://2c0d2da223ce1abb9fa4ed3faaf01955@o4510117752471552.ingest.us.sentry.io/4510118514589696
traces-sample-rate: 1.0
send-default-pii: true


spring:
application:
name: back
Expand Down