• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

로그인 실패 시 응답이 html로 옵니다.

23.01.09 23:08 작성 조회수 397

0

비밀번호를 틀리게 주어 로그인 시도했을 경우 강의와 다르게 응답이 html로 옵니다.. 어떻게 강의처럼 json으로 바꿀 수 있나요??

<!doctype html>
<html lang="en">

<head>
	<title>HTTP Status 401 – Unauthorized</title>
	<style type="text/css">
		body {
			font-family: Tahoma, Arial, sans-serif;
		}

		h1,
		h2,
		h3,
		b {
			color: white;
			background-color: #525D76;
		}

		h1 {
			font-size: 22px;
		}

		h2 {
			font-size: 16px;
		}

		h3 {
			font-size: 14px;
		}

		p {
			font-size: 12px;
		}

		a {
			color: black;
		}

		.line {
			height: 1px;
			background-color: #525D76;
			border: none;
		}
	</style>
</head>

<body>
	<h1>HTTP Status 401 – Unauthorized</h1>
	<hr class="line" />
	<p><b>Type</b> Status Report</p>
	<p><b>Message</b> Unauthorized</p>
	<p><b>Description</b> The request has not been applied because it lacks valid authentication credentials for the
		target resource.</p>
	<hr class="line" />
	<h3>Apache Tomcat/9.0.62</h3>
</body>

</html>

 

강의 화면

답변 1

답변을 작성해보세요.

0

cocoguy님의 프로필

cocoguy

2023.02.04

안녕하세요.

저도 동일한 문제로 찾아보다가 inflearn1212 답변글 보고 참고해서 해결했습니다.

https://www.inflearn.com/questions/423204/%EB%B9%84%EA%B5%90%EC%A0%81-%EC%B5%9C%EC%8B%A0-%EB%B2%84%EC%A0%84%EC%97%90%EC%84%9C-%EC%97%90%EB%9F%AC%EA%B0%80-%EB%B0%9C%EC%83%9D%ED%95%A9%EB%8B%88%EB%8B%A4

WebSecurity 에 밑에 부분 추가하니 json 형식으로 응답이 왔습니다.

.antMatchers("/error/**").permitAll()