JWT Authentication in Spring Security
Moving forward, let’s examine the architectural elements employed by Spring Security
to facilitate JWT Authentication in servlet-based applications, similar to the one we previously discussed.
The JwtAuthenticationProvider
serves as an implementation of AuthenticationProvider
, utilizing a JwtDecoder
and JwtAuthenticationConverter
to validate a JWT during authentication.
Now, let’s delve into the workings of JwtAuthenticationProvider
within the context of Spring Security
. The accompanying figure elucidates the intricacies of the AuthenticationManager
, as illustrated in the figures depicting the process of reading the Bearer Token.
Figure 17.3 – JWT Authentication in Spring Security
The JWT authentication in spring-security entails the following steps:
- The Authentication Filter, as part of the process outlined in reading the Bearer Token, transfers a
BearerTokenAuthenticationToken
to...