From 97c0822f15ff56be3c666972742f635e9e886047 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 20 九月 2023 17:46:18 +0800
Subject: [PATCH] Merge branch 'dev' of http://139.186.142.91:10010/r/productDev/preselect into dev
---
server/company/src/main/java/com/doumee/config/shiro/ShiroAuthFilter2.java | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/server/company/src/main/java/com/doumee/config/shiro/ShiroAuthFilter2.java b/server/company/src/main/java/com/doumee/config/shiro/ShiroAuthFilter2.java
new file mode 100644
index 0000000..4f70f30
--- /dev/null
+++ b/server/company/src/main/java/com/doumee/config/shiro/ShiroAuthFilter2.java
@@ -0,0 +1,31 @@
+package com.doumee.config.shiro;
+
+import com.alibaba.fastjson.JSON;
+import com.doumee.core.model.ApiResponse;
+import org.apache.shiro.web.filter.authc.FormAuthenticationFilter;
+import org.springframework.http.HttpStatus;
+
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Shiro璁よ瘉杩囨护鍣紝澶勭悊鏈璇佹儏鍐电殑鍝嶅簲
+ * @author Eva.Caesar Liu
+ * @date 2023/04/17 12:11
+ */
+public class ShiroAuthFilter2 extends FormAuthenticationFilter {
+
+ public ShiroAuthFilter2() {
+ super();
+ }
+
+ @Override
+ protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
+
+ HttpServletResponse servletResponse = (HttpServletResponse) response;
+ servletResponse.setHeader("content-type", "application/json;charset=UTF-8");
+ servletResponse.getWriter().write(JSON.toJSONString(ApiResponse.failed(HttpStatus.UNAUTHORIZED.value(), "鏈櫥褰曟垨鐧诲綍淇℃伅宸茶繃鏈�")));
+ return Boolean.FALSE;
+ }
+}
--
Gitblit v1.9.3