Tag: jwt

How to Implement JWT Token Based Authentication in Spring Boot Microservices

Java, Spring Boot, Tools
JWT (JSON Web Token) tokens are an open, industry standard RFC 7519 method for representing claims securely between two parties. It is highly recommended and used authentication method for REST API & Webservices. Today we are going to see how to implement JWT token based authentication in spring boot microservices to securely communicate and transfer the data's between the client(any client applications, angular/react/vue in modern application world) and server side applications. Though process for Token Based Authentication Spring security is needed for JWT token based authentication Ensure the signup / login REST API accesses are allowed in spring security (or disable these two API's) During signup, save the captured user details in the user table then generate and res

[Resolved] Spring boot JWT Filter called twice

Errors and solutions
[Resolved] Spring boot JWT Filter called twice: Recently when I was integrating JWT Filter and Simple CORS filter in my spring boot project, I observed that both the filters are called twice before actually reaching my servlet/rest controller.   After googling, I got this link, As per that, One invocation is by servlet container and the other is by Spring Security, so the filter will get called twice. So by adding this line in your JWT Filter bean implementation registrationBean.setEnabled(false); only the spring security calls for token, so JWT filter call twice issue will get resolved.   Issue Code: [Called twice] [java] @Bean public FilterRegistrationBean jwtFilter(){ final FilterRegistrationBean registrationBean = new FilterRegistrationBean(); registra