in src/main/java/com/epam/digital/data/platform/starter/security/jwt/DefaultAuthenticationEntryPoint.java [38:53]
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException {
// If user tries to access a secured REST resource without supplying any credentials
// We just send a 401 Unauthorized response because there is no 'login page' to redirect to
response.setContentType(MediaType.APPLICATION_JSON_VALUE);
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
response.getWriter().write(objectMapper.writeValueAsString(
new ErrorRestResponseDto(
ErrorDto.builder()
.code("401")
.message("Unauthorized")
.traceId(MDC.get("X-B3-TraceId"))
.build()
)
));
}