Spring LDAP示例

时间:2012-08-28 12:17:16

标签: java spring grails spring-security

使用使用spring的java Web应用程序。我需要在登录我的应用程序之前对用户进行身份验证。我需要使用LDAP。我用谷歌搜索,没有得到适当的样本。因为我是java的新手,所以无法通过完整的1个循环的代码。下面是我得到的示例配置文件。但在哪里使用它以及如何使用它?我从名为ADExplorer的软件中获取了我的ADS详细信息。任何人都可以指导我如何做到这一点的持续流程?

// LDAP config
grails.plugins.springsecurity.ldap.context.managerDn = '10010101'
grails.plugins.springsecurity.ldap.context.managerPassword ='Temppass@123'
grails.plugins.springsecurity.ldap.context.server = 'ldap://DOMAIN.com:3268/'
grails.plugins.springsecurity.ldap.authorities.ignorePartialResultException = true // typically needed for Active Directory
grails.plugins.springsecurity.ldap.search.base = 'DC=DOMAIN,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','employeeID'] // 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 = false

grails.plugin.quartz2.autoStartup = true

1 个答案:

答案 0 :(得分:0)

看起来你正在使用grails,你可以使用ldap plugin