/*
 * @Author: Kane
 * @Date: 2023-01-12 15:01:22
 * @LastEditors: Kane
 * @LastEditTime: 2023-01-24 00:21:51
 * @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\filters\token\TokenFilter.java
 * @Description: 用于检查token的过滤器
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 */
package com.cpic.xim.web.filters.token;

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings( "unused" )
public class TokenFilter implements Filter
{
    /*****************************************************
     * 对请求的token进行验证。
     *****************************************************/
    @Override
    public void doFilter( ServletRequest req, ServletResponse resp, FilterChain chain )
            throws ServletException, IOException
    {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpServletResponse response = (HttpServletResponse) resp;

        // 验证Token
        String token = request.getHeader( "Token" );

        chain.doFilter( request, response );
    }
}

