Commit cde9b341 authored by 赵啸非's avatar 赵啸非

提交配置校验

parent 9ff6fa97
...@@ -8,12 +8,14 @@ import com.alibaba.fastjson.JSONObject; ...@@ -8,12 +8,14 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil; import com.mortals.framework.util.AESUtil;
import com.mortals.framework.utils.ServletUtils; import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor; import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.config.InterceptorConfig; import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.common.code.ApiRespCodeEnum; import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.common.key.RedisKey;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -44,6 +46,8 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -44,6 +46,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
private InterceptorConfig config; private InterceptorConfig config;
@Autowired @Autowired
private IAuthTokenService authTokenService; private IAuthTokenService authTokenService;
@Autowired
private ICacheService cacheService;
@Value("${trustedReferer:''}") @Value("${trustedReferer:''}")
private String trustedReferer; private String trustedReferer;
...@@ -57,8 +61,8 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -57,8 +61,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception { throws Exception {
//response.setContentType("application/json"); //response.setContentType("application/json");
//String referer = request.getHeader("Referer");
String referer = request.getHeader("Referer"); String referer = cacheService.get(RedisKey.KEY_REFERERS_CACHE);
if (!ObjectUtils.isEmpty(referer)) { if (!ObjectUtils.isEmpty(referer)) {
//校验host即可 //校验host即可
URI host = URLUtil.getHost(new URL(referer)); URI host = URLUtil.getHost(new URL(referer));
......
...@@ -42,6 +42,6 @@ public class RedisKey { ...@@ -42,6 +42,6 @@ public class RedisKey {
/** /**
* referers * referers
*/ */
public static final String KEY_REFERERS_CACHE = "referers:"; public static final String KEY_REFERERS_CACHE = "referers";
} }
...@@ -5,10 +5,6 @@ package com.mortals.xhx.common.key; ...@@ -5,10 +5,6 @@ package com.mortals.xhx.common.key;
*/ */
public class RedisKey { public class RedisKey {
/**
* 登录 cookies key
*/
public static final String KEY_MENU_CACHE = "iot:base:MenuCacheKey:";
public static final String KEY_USER_MENU_CACHE = "user:menu"; public static final String KEY_USER_MENU_CACHE = "user:menu";
...@@ -16,9 +12,6 @@ public class RedisKey { ...@@ -16,9 +12,6 @@ public class RedisKey {
public static final String KEY_BURY_POINT_CACHE = "bury:point"; public static final String KEY_BURY_POINT_CACHE = "bury:point";
/** public static final String KEY_REFERERS_CACHE = "referers";
* referers
*/
public static final String KEY_REFERERS_CACHE = "referers:";
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment