【Spring Securtiy】A granted authority textual representation is required

【Spring Securtiy】A granted authority textual representation is required,第1张

今天项目出了A granted authority textual representation is required的报错,经过排查是SpringSecurity中的UserDetails.getAuthorities()在创建SimpleGrantedAuthority authority的时候呢,所传递的授权信息是空的,导致SimpleGrantedAuthority authority出现异常报出A granted authority textual representation is required异常。
在排查后是因为所传递的权限数组有空值的数据存在,在数据库中链表查询时,导致原本没有数据的表会查出null数据的可能,在所需要的数据所对应的数据列添加is not null来进行判断可以修复该bug。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/889860.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-14
下一篇 2022-05-14

发表评论

登录后才能评论

评论列表(0条)

保存