szerhusenBC/jwt-spring-security-demo

filter chain fire mulitple times(3 times)

hafizan opened this issue · 9 comments

i check log evertime the request made.. it will check 3 times. why is that?
log:
2018-06-04 12:12:44.756 WARN 17534 --- [nio-8080-exec-5] o.z.s.JwtAuthenticationTokenFilter : couldn't find bearer string, will ignore the header
2018-06-04 12:12:44.756 INFO 17534 --- [nio-8080-exec-5] o.z.s.JwtAuthenticationTokenFilter : checking authentication for user null
2018-06-04 12:12:44.807 WARN 17534 --- [nio-8080-exec-6] o.z.s.JwtAuthenticationTokenFilter : couldn't find bearer string, will ignore the header
2018-06-04 12:12:44.807 INFO 17534 --- [nio-8080-exec-6] o.z.s.JwtAuthenticationTokenFilter : checking authentication for user null
2018-06-04 12:12:44.808 WARN 17534 --- [nio-8080-exec-7] o.z.s.JwtAuthenticationTokenFilter : couldn't find bearer string, will ignore the header
2018-06-04 12:12:44.808 INFO 17534 --- [nio-8080-exec-7] o.z.s.JwtAuthenticationTokenFilter : checking authentication for user null
2018-06-04 12:12:46.201 WARN 17534 --- [nio-8080-exec-8] o.z.s.JwtAuthenticationTokenFilter : couldn't find bearer string, will ignore the header
2018-06-04 12:12:46.201 INFO 17534 --- [nio-8080-exec-8] o.z.s.JwtAuthenticationTokenFilter : checking authentication for user null

I tried it with the JS client from the demo and I can't reproduce your problem. I only have one log entry when I request the admin endpoint without authentication. Can you provide more information?

i use angular 6 for the frontend. and everytime request made, even for login, it will fire like logs above.

i try inspect network monitor for request. it looks like it send two request. one OPTIONS method and the other one POST, others request also same, if i send GET request it will together with OPTIONS. so each request become 2.

OK, this gives us the cause of two log entries. I still don't know why you have three of them. When I perform a request against my demo I only have one entry.

Perhaps this can help you handling the OPTIONS request:

#68

okay..thank you so much for this solution

@hafizan You're welcome ;) If it is okay I would close this ticket now.

Closed, because I published a complete new version.