简体   繁体   English

使用spring-security-core-ldap插件在grails中实现LDAP身份验证?

[英]Implementing LDAP authentication in grails with spring-security-core-ldap plugin?

I am currently looking into creating an application within Grails and I have created the app and installed both plugins below: 我目前正在考虑在Grails中创建一个应用程序,我已经创建了应用程序,并在下面安装了两个插件:

http://grails.org/plugin/spring-security-ldap http://grails.org/plugin/spring-security-core http://grails.org/plugin/spring-security-ldap http://grails.org/plugin/spring-security-core

I then went ahead and run the following command in order to get the security core setup: 然后我继续运行以下命令以获得安全核心设置:

grails s2-quickstart com.smstool User Role

That then created all the necessary controllers, views and models I would need. 然后创建了我需要的所有必要的控制器,视图和模型。 From there I then went on to update the config.groovy file with the following options: 然后我从那里继续使用以下选项更新config.groovy文件:

grails.plugins.springsecurity.ldap.authorities.groupSearchBase = 'DC=MYLOCATION, DC=COM'
grails.plugins.springsecurity.ldap.authorities.retrieveDatabaseRoles = false
grails.plugins.springsecurity.ldap.authorities.ignorePartialResultException = true // typically needed for Active Directory
grails.plugins.springsecurity.ldap.search.base = 'DC=MYLOCATION, DC=COM'
grails.plugins.springsecurity.ldap.search.filter="sAMAccountName={0}" // for Active Directory you need this
grails.plugins.springsecurity.ldap.search.searchSubtree = true
grails.plugins.springsecurity.ldap.auth.hideUserNotFoundExceptions = false
grails.plugins.springsecurity.ldap.search.attributesToReturn = ['mail', 'displayName'] // extra attributes you want returned; see below for custom classes that access this data
grails.plugins.springsecurity.providerNames = ['ldapAuthProvider', 'anonymousAuthenticationProvider'] // specify this when you want to skip attempting to load from db and only use LDAP

// role-specific LDAP config 
grails.plugins.springsecurity.ldap.useRememberMe = false 
grails.plugins.springsecurity.ldap.authorities.retrieveGroupRoles = true 
grails.plugins.springsecurity.ldap.authorities.groupSearchBase = 'DC=MYLOCATION, DC=COM'

I then ran the application and went to the Login page that was created when i run the first command (s2-quickstart), however when I try to enter my LDAP details I do not get an error however it says the username doesn't exist. 然后我运行应用程序并转到我运行第一个命令(s2-quickstart)时创建的登录页面,但是当我尝试输入我的LDAP详细信息时,我没有收到错误但是它说用户名不存在。

I think this may be due to the fact that there is further configuration needed to get this LDAP functionality to work and the details the user enters are not being passed correctly, also I am new to Grails :-). 我认为这可能是因为需要进一步配置才能使这个LDAP功能正常工作,并且用户输入的详细信息没有正确传递,我也是Grails的新手:-)。

I think I may have to do something like create a "UserDetailsContextMapper" however I do not know how to do this and I have looked at the link below but cant seem to grasp what I need to do: 我想我可能要做一些事情,比如创建一个“UserDetailsContextMapper”但是我不知道如何做到这一点,我看了下面的链接,但似乎无法掌握我需要做的事情:

http://grails-plugins.github.com/grails-spring-security-ldap/docs/manual/guide/2.%20Usage.html http://grails-plugins.github.com/grails-spring-security-ldap/docs/manual/guide/2.%20Usage.html

Is there anyone who can help me understand the link above or who knows the steps I should take to properly authenticate against LDAP?? 是否有人可以帮助我理解上面的链接或谁知道我应采取的步骤来正确验证LDAP?

Thanks in advance :-) 提前致谢 :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM