Grails:使用 Spring Security 插件进行 Commentable 的用户评估器

2023-12-22

我正在尝试将可评论插件与 Spring Security 一起使用。

我无法写出正确的

grails.commentable.poster.evaluator

我尝试了 {User.get(springSecurityService.principal.id)}, 但从 CommentController 来看,User 和 springSecurity 似乎都无法访问。

我应该怎么办?


For springSecurityService.principal.id因为没有依赖注入字段springSecurityService它无法工作,所以你需要调用什么springSecurityService.principal.id来电 -org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.id

要解决 User 的问题,您需要带有 package.json 的完整类名。综合起来,应该是这样的

{com.yourcompany.yourapp.User.get(org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.id)}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Grails:使用 Spring Security 插件进行 Commentable 的用户评估器 的相关文章

随机推荐