Spring Oauth2 JWT : Authentication Object was not found in the SecurityContext
I’m working on a project that does authentication based on JWT. Until now I was able to hit my token API and authorize other APIs with it. Strangely today I’m not able to hit any request at all! I get a 401 Unauthorised on all of them, but no authentication happens in the first place. On some debugging, I saw I was getting a ROLE_ANONYMOUS
authority from one of the default filters.
After disabling that, I get, Authentication Object was not found in the SecurityContext
error. Then I saw that the deferredContext
supplier in SecurityContextHolderFilter
returns null. I have no clue on how to proceed, any help would be appreciated.
Here’s my SecurityConfig file, I’m fairly new to spring, so please bear with me.