From 576f7eefe00832b8a7f7750cfd0ee6975bcf6acf Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Mon, 15 Jun 2020 10:16:02 +0800
Subject: [PATCH] 20200615   代码提交

---
 src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java b/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java
index a28ffb8..7f8444c 100644
--- a/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java
+++ b/src/main/java/com/xcong/excoin/configurations/security/CustomAuthenticationEntryPoint.java
@@ -6,6 +6,7 @@
 import org.springframework.security.web.AuthenticationEntryPoint;
 
 import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -18,9 +19,10 @@
 
     @Override
     public void commence(HttpServletRequest httpServletRequest, HttpServletResponse response, AuthenticationException e) throws IOException, ServletException {
-        Result result = Result.loginFail("fail");
+        Result result = Result.loginFail("Unauthorized");
         response.setCharacterEncoding("UTF-8");
         response.setContentType("application/json; charset=utf-8");
         response.getWriter().write(new ObjectMapper().writeValueAsString(result));
+        response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
     }
 }

--
Gitblit v1.9.1