最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

spring boot 3 - Facing issue with hasRole post migrating to SpringBoot 3.4.1 which was working fine earlier - Stack Overflow

programmeradmin4浏览0评论

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论