服务器 Gind.cn

服务器问题集锦,包括 Linux(Ubuntu, Centos,Debian等)和Windows Server服务器

使用Active Directory的Java应用程序authentication

我正在开发第三方Java应用程序,我需要使用Active Directory对其用户进行身份validation。 此应用程序托pipe在RHEL 6.5上,并使用LDAP通过Windows Active Directory进行身份validation。 AD服务器已经build立,并且与早期版本的应用程序(已configuration为启用集成)工作正常。 对于较新的版本,供应商已经规划了一些步骤来修改/configuration应用程序文件以连接到AD服务器,并期望帮助我们进行身份validation。 应用程序的组件之一是CAS,它当前被configuration为使用数据库作为其身份validation处理程序。 当我们input凭据 – 用户名:abcd,密码:samplepswd,我们能够成功login。 由于业务需求是使用LDAP使用Active Directory进行身份validation,因此我们必须修改CAS属性文件。 根据产品供应商的说明,我们更改了以下属性以使用ldap – authenticationHandler.type=ldap ldapSSLConfig.enabled=false ldapContextSource.url=ldap://sample.ADserver.example.net:389 ldapContextSource.userDn=abcd ldapContextSource.password=samplepswd ldapAuthenticationHandler.filter=uid=%u ldapAuthenticationHandler.searchBase=OU=DEF,OU=PQR,OU=XYZ,DC=ADserver,DC=example,DC=net 我们还需要对casAuthConfig xml文件进行以下属性的更改(因为不支持匿名search):1. anonymousReadOnly,value设置为false 2. java.naming.security.authentication,value设置为simple 有规定也可以使用SSL上的ldap,但目前我们没有使用。 但是,如果我们使用SSL,则必须对以下属性进行其他更改: ldapSSLConfig.enabled=true ldapSSLConfig.trustStorePath=/home/dir1/subdir1/subdir2/keystorename.keystore ldapSSLConfig.trustStoreType=jceks 这些是在我们(客户端)完成的唯一configuration更改; 实际上只做了一些改变。 服务器(AD服务器)上除了另一个用户以外没有添加/修改任何内容,但是这对现有设置没有影响。 重新启动cas以反映更改后,我们会遇到错误的凭据错误,虽然input的值是正确的: 2015-09-16 12:12:30,558 INFO [com.emeter.cas.authentication.support.DelegatingAuthenticationHandler] – Authenticating credential using handler com.emeter.cas.adaptors.ldappwd.BindLdapAuthenticationHandler 2015-09-16 12:12:30,558 DEBUG [com.emeter.cas.authentication.support.DelegatingAuthenticationHandler] – credentials.getUsername() = abcd […]