We have migrated to SpringBoot 3.4.1 recently and post that, hasRole
and hasAnyRole
are not working for me.
Below is what my token looks like :
{ "sub": "test-client", "lastName": "Admin", "user_name": "admin", "roles": [ "SE_ADMIN" ], "iss": "http://localhost:8000", "authorities": [ "ROLE_UPDATE", "ROLE_VIEW" ], "exp": 1742806186, "iat": 1742805586 }
In my controller, I want to use @PreAuthorize("hasRole('ROLE_UPDATE')")
However, it is not working.
I tried debugging it and noticed that I am not getting value of authorities in Spring Security internal libraries to compare.