|
@@ -2,6 +2,7 @@ package com.fjhx.xmhjc.aspect;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.extra.servlet.ServletUtil;
|
|
|
import com.fjhx.xmhjc.anno.LoginValid;
|
|
|
import com.fjhx.xmhjc.constants.LoginConstant;
|
|
|
import com.fjhx.xmhjc.entity.website.po.WebsiteUsers;
|
|
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @author hj
|
|
@@ -34,6 +36,10 @@ public class LoginValidAspect {
|
|
|
@Before("@annotation(loginValid)")
|
|
|
public void loginValidBefore(LoginValid loginValid) {
|
|
|
HttpServletRequest request = ServletUtils.getRequest();
|
|
|
+ Map<String, String> headerMap = ServletUtil.getHeaderMap(request);
|
|
|
+ headerMap.forEach((k, v) -> {
|
|
|
+ System.out.println(k + ":" + v);
|
|
|
+ });
|
|
|
String token = request.getHeader(LoginConstant.LONGIN_HEAD);
|
|
|
if (StrUtil.isBlank(token)) {
|
|
|
throw new RuntimeException("请先登录");
|