Spring Security LDAP 的可注释插件

发布于 2024-11-03 02:09:07 字数 975 浏览 1 评论 0原文

我正在尝试让可评论的插件与 Burt Beckwith 的 spring 安全框架 ldap 插件一起运行。

我在此处发现了类似的问题。

唯一的区别似乎是我使用 LDAP 并且 LDAP 用户详细信息没有 ID,或者我没有看到它。

我尝试将 grails.commentable.poster.evaluator 设置为

{com.companyname.sec.User.get(org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.id)}

以及 设置为

{com.companyname.sec.User.get(principal.id)}

这两个都是我在上面提到的其他问题中建议的。我得到的是下面的错误:

groovy.lang.MissingPropertyException: No such property: id for class: org.springframework.security.ldap.userdetails.LdapUserDetailsImpl

可能的解决方案:dn

这似乎建议使用 dn 字段,但由于那是一个字符串,并且 id 是 Long,我认为这不是正确的选择。那么,有没有一种方法可以配置 grails.commentable.poster.evaluator 以使这两个插件一起工作,或者我是否需要修改其中一个以获得兼容的类型(即将 commentable 插件更改为使用字符串,然后从 LDAP 用户详细信息中获取用户名。)?

I'm trying to get the commentable plug-in running with the spring security framework ldap plugin from Burt Beckwith.

I found a similar problem here.

The only difference seems to be that I'm using LDAP and the LDAP user details don't have an id, or I'm not seeing it.

I've tried setting the grails.commentable.poster.evaluator to

{com.companyname.sec.User.get(org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.id)}

and also to

{com.companyname.sec.User.get(principal.id)}

Both of these were suggested in the other issue I referenced above. What I get is the error below:

groovy.lang.MissingPropertyException: No such property: id for class: org.springframework.security.ldap.userdetails.LdapUserDetailsImpl

Possible solutions: dn

This seems to suggest using the dn field, but since that's a string, and the id is a Long, I don't think that's the right option. So, is there a way to configure the grails.commentable.poster.evaluator to get these two plug-ins to work together, or do I need to modify one of them to get a compatible type (i.e. change the commentable plug-in to use a String, and then grab the username from the LDAP user details.)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

灼疼热情 2024-11-10 02:09:07

不使用可注释的插件,而是使用 spring-security-ldap 插件。

对我来说,这个非常简单的复制和粘贴解决方案有效:

Burt 的 Grails Jira 解决方案

Not using the commentable but the spring-security-ldap plugin.

For me this really simple copy&paste solution worked:

Solution on Grails Jira by Burt

吾性傲以野 2024-11-10 02:09:07

使用

{com.companyname.sec.User.findByUsername(principal.username)}

{com.companyname.sec.User.findByUsername(org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.username)}

Use

{com.companyname.sec.User.findByUsername(principal.username)}

or

{com.companyname.sec.User.findByUsername(org.springframework.security.core.context.SecurityContextHolder.context.authentication.principal.username)}
记忆消瘦 2024-11-10 02:09:07

这给了我以下错误:

org.grails.comments.CommentException: No [grails.commentable.poster.evaluator] setting defined or the evaluator doesn't evaluate to an entity. Please define the evaluator correctly in grails-app/conf/Config.groovy or ensure commenting is secured via your security rules

我读到这意味着没有 findByUsername 方法。那么,您是否建议我创建该方法来获取 id 值?我相应地假设,这意味着我需要将 ldap 用户插入数据库才能生成 id。

That gives me the following error:

org.grails.comments.CommentException: No [grails.commentable.poster.evaluator] setting defined or the evaluator doesn't evaluate to an entity. Please define the evaluator correctly in grails-app/conf/Config.groovy or ensure commenting is secured via your security rules

I read that to mean there is no findByUsername method. So, were you suggesting I create that method in order to get at an id value? And I assume correspondingly, that means I need to insert the ldap users into the database in order to generate an id.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文