Servlet过滤器多次调用

时间:2019-07-08 06:23:27

标签: authentication filter servlet-filters

在同一请求中多次调用了用于身份验证的servlet过滤器。由于浏览器不断加载,实习生不允许对用户进行身份验证。

下面是web.xml-

<filter>
    <filter-name>AuthenticationFilter</filter-name>
    <filter-class>com.company.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
    <filter-name>AuthenticationFilter</filter-name>
    <url-pattern>*</url-pattern>
</filter-mapping>

过滤器实现类-

public void doFilter(ServletRequest request, ServletResponse response,    FilterChain chain) throws IOException, ServletException {

HttpServletRequest httpRequest = (HttpServletRequest) request;

AuthenticationService service = new AuthenticationService();
service.validateAuthentication(request, response);

if(!response.isCommitted()) {
    doFilter(request, response);
}

}

validateAuthentication,哪个实习生执行天蓝色身份验证。

2019-07-08 01:50:45,927 INFO [com.microsoft.aad.adal4j.AuthenticationAuthority] (pool-235-thread-1) [Correlation ID: 424f42b1-15e9-44e7-b2d8-84b82fe89132] Instance discovery was successful 2019-07-08 01:50:46,166 ERROR [com.microsoft.aad.adal4j.AuthenticationContext] (pool-235-thread-1) [Correlation ID: 424f42b1-15e9-44e7-b2d8-84b82fe89132] Execution of class com.microsoft.aad.adal4j.AcquireTokenCallable failed.: com.microsoft.aad.adal4j.AuthenticationException: {"error_description":"AADSTS500112: The reply address 'http://docker.azurewebsites.net/' does not match the reply address 'https://docker.azurewebsites.net/' provided when requesting Authorization code.\r\nTrace ID: e6b5f37f-4bcd-4233-aab4-e98d725f7400\r\nCorrelation ID: 424f42b1-15e9-44e7-b2d8-84b82fe89132\r\nTimestamp: 2019-07-08 05:50:46Z","error":"invalid_client"} at com.microsoft.aad.adal4j.AdalTokenRequest.executeOAuthRequestAndProcessResponse(AdalTokenRequest.java:128) at com.microsoft.aad.adal4j.AuthenticationContext.acquireTokenCommon(AuthenticationContext.java:928) at com.microsoft.aad.adal4j.AcquireTokenCallable.execute(AcquireTokenCallable.java:70) at com.microsoft.aad.adal4j.AcquireTokenCallable.execute(AcquireTokenCallable.java:38) at com.microsoft.aad.adal4j.AdalCallable.call(AdalCallable.java:47) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

0 个答案:

没有答案