package com.jeiker.demo.jwt;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter;
import org.springframework.stereotype.Component;

/**
 * 配置请求头认证过滤器-JWT验证
 *
 * @Author : xiao
 * @Date : 17/8/4 上午9:52
 */
@Component
public class JsonWebTokenAuthenticationFilter extends RequestHeaderAuthenticationFilter {

    public JsonWebTokenAuthenticationFilter() {
        // Don't throw exceptions if the header is missing
        this.setExceptionIfHeaderMissing(false);

        // This is the request header it will look for
        this.setPrincipalRequestHeader("Authorization");
    }

    @Override
    @Autowired
    public void setAuthenticationManager(AuthenticationManager authenticationManager) {
        super.setAuthenticationManager(authenticationManager);
    }
}

@@ -547,55 +547,28 @@
  // 
-Don't throw exceptions if the header is missing
+%E5%BD%93 header %E5%A4%B4%E6%B2%A1%E6%9C%89%E4%BF%A1%E6%81%AF%E6%97%B6,%E4%B8%8D%E6%8A%9B%E5%BC%82%E5%B8%B8
 %0A   
@@ -629,51 +629,24 @@
  // 
-This is the request header it will look for
+%E6%9F%A5%E6%89%BE header %E4%B8%AD%E7%9A%84%E8%AE%A4%E8%AF%81%E4%BF%A1%E6%81%AF
 %0A   
@@ -706,16 +706,47 @@
 %0A    %7D%0A%0A
+    /**%0A     * %E8%AE%BE%E7%BD%AE%E8%AE%A4%E8%AF%81%E7%AE%A1%E7%90%86%E5%99%A8%0A     */%0A
     @Ove

add description