Spring Security LDAP 的可注释插件
我正在尝试让可评论的插件与 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不使用可注释的插件,而是使用 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
使用
或
Use
or
这给了我以下错误:
我读到这意味着没有 findByUsername 方法。那么,您是否建议我创建该方法来获取 id 值?我相应地假设,这意味着我需要将 ldap 用户插入数据库才能生成 id。
That gives me the following error:
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.