|
|
@@ -0,0 +1,34 @@
|
|
|
+package com.nb.common.config.web.handler;
|
|
|
+
|
|
|
+import com.nb.auth.bean.LoginUser;
|
|
|
+import com.nb.auth.utils.SecurityUtil;
|
|
|
+import com.nb.core.exception.RequestParmErrorException;
|
|
|
+import com.nb.core.exception.RequestSignErrorException;
|
|
|
+import org.springframework.core.annotation.Order;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.web.servlet.HandlerInterceptor;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author lifang
|
|
|
+ * @version 1.0.0
|
|
|
+ * @ClassName LoginTypeHandler.java
|
|
|
+ * @Description 权限体系认证请求头
|
|
|
+ * @createTime 2022年04月19日 14:22:00
|
|
|
+ */
|
|
|
+@Component
|
|
|
+@Order(999)
|
|
|
+public class LoginTypeHandler implements HandlerInterceptor {
|
|
|
+ @Override
|
|
|
+ public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler){
|
|
|
+ LoginUser loginUser = SecurityUtil.getLoginUser();
|
|
|
+ String header = request.getHeader("Login-Type");
|
|
|
+ if(header==null){
|
|
|
+ //未登录且未带 Tenant-Id 请求头
|
|
|
+ throw new RequestParmErrorException();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+}
|