Update TokenFilter.java

木子李·De 3 years ago
parent 2932a09884
commit 8d1f8b9037

@ -14,7 +14,6 @@ import org.apache.http.entity.ContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.CollectionUtils;
@ -41,9 +40,9 @@ import static com.anji.plus.gaea.constant.GaeaConstant.URL_REPLACEMENT;
public class TokenFilter implements Filter {
private static final Pattern PATTERN = Pattern.compile(".*().*");
private static final String USER_GUEST = "guest";
@Value("${server.servlet.context-path:'/'}")
private static final String SLASH = "/";
private AntPathMatcher antPathMatcher = new AntPathMatcher();
private String SLASH = "/";
@Autowired
private CacheHelper cacheHelper;
@ -55,6 +54,8 @@ public class TokenFilter implements Filter {
private List<String> skipAuthenticateUrls;
private Pattern skipAuthenticatePattern;
private AntPathMatcher antPathMatcher = new AntPathMatcher();
@Override
public void init(FilterConfig filterConfig) throws ServletException {
// 生成匹配正则跳过token验证和权限验证的url
@ -166,9 +167,6 @@ public class TokenFilter implements Filter {
return;
}
// 延长有效期
cacheHelper.stringSetExpire(tokenKey, token, 3600);
cacheHelper.stringSetExpire(userKey, gaeaUserJsonStr, 3600);

Loading…
Cancel
Save