@@ -0,0 +1,1889 @@
+package net.moopa3376.guard.fliter;%0A%0Aimport java.io.IOException;%0A%0Aimport javax.servlet.Filter;%0Aimport javax.servlet.FilterChain;%0Aimport javax.servlet.FilterConfig;%0Aimport javax.servlet.ServletException;%0Aimport javax.servlet.ServletRequest;%0Aimport javax.servlet.ServletResponse;%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport net.moopa3376.guard.config.GuardConfigs;%0Aimport net.moopa3376.guard.jwt.JwtWrapper;%0A%0A/**%0A * Created by Moopa on 17/07/2017.%0A * blog: moopa.net%0A *%0A * @autuor : Moopa%0A */%0Apublic class TokenFilter implements Filter%7B%0A    public static long expireIntervalTime = 12000;%0A    public void init(FilterConfig filterConfig) throws ServletException %7B%0A%0A    %7D%0A%0A    /**%0A     * %E8%AF%A5%E6%96%B9%E6%B3%95%E4%B8%BB%E8%A6%81%E6%98%AF%E9%92%88%E5%AF%B9%E5%8D%B3%E5%B0%86%E8%BF%87%E6%9C%9F%E7%9A%84jwt token%E8%BF%9B%E8%A1%8C%E6%9B%B4%E6%96%B0%0A     * @param servletRequest%0A     * @param servletResponse%0A     * @param filterChain%0A     * @throws IOException%0A     * @throws ServletException%0A     */%0A    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException %7B%0A        filterChain.doFilter(servletRequest,servletResponse);%0A%0A        //%E9%A6%96%E5%85%88%E8%8E%B7%E5%8F%96token%0A        String token = ((HttpServletRequest)servletRequest).getHeader(%22X-token%22);%0A%0A        //token == null %E8%A1%A8%E7%A4%BA%E8%AF%A5%E8%AF%B7%E6%B1%82%E5%B9%B6%E4%B8%8D%E9%9C%80%E8%A6%81%E7%99%BB%E5%BD%95 - %E5%9B%A0%E4%B8%BA%E5%89%8D%E9%9D%A2%E5%B7%B2%E7%BB%8F%E6%9C%89guard%E5%9C%A8%E8%BF%87%E6%BB%A4%E4%BA%86%0A        if(token == null)%7B%0A            return;%0A        %7D%0A%0A        long current = System.currentTimeMillis();%0A        String expire = JwtWrapper.getValInPayload(token,%22expire%22);%0A        long expire_l = Long.valueOf(expire);%0A%0A        if(expire_l - current %3C= expireIntervalTime)%7B%0A            //%E6%9B%B4%E6%96%B0token%0A            String res = JwtWrapper.updateJwt(token,expire, String.valueOf(current+Long.valueOf(GuardConfigs.get(%22expire_time%22))));%0A%0A            //%E5%9C%A8response%E4%B8%AD%E6%9B%B4%E6%96%B0token%0A            ((HttpServletResponse)servletResponse).setHeader(%22X-token%22,res);%0A        %7D%0A    %7D%0A%0A    public void destroy() %7B%0A%0A    %7D%0A%7D%0A

add toke filter