设置Archiva使用LDAP验证
Apache Archiva是一个Maven私服工具,功能完备,和Nexus相比更适合商业使用,它的安装和运行十分简单。Archiva缺省是使用独立的用户验证,但它也支持LDAP验证,要做如下配置 (1.3.5版本):
1. 修改<archiva_dir>/apps/archiva/WEB-INF/classes/META-INF/plexus/application.xml
LDAP connection部分的component缺省被注释掉了,把注释去掉,如下:
<component> <role>org.codehaus.plexus.redback.common.ldap.connection.LdapConnectionFactory</role> <role-hint>configurable</role-hint> <implementation>
org.codehaus.plexus.redback.common.ldap.connection.ConfigurableLdapConnectionFactory
</implementation> <requirements> <requirement> <role>org.codehaus.plexus.redback.configuration.UserConfiguration</role> </requirement> </requirements> </component>
2. 修改<archiva_dir>/apps/archiva/WEB-INF/classes/org/apache/maven/archiva/security.properties
加入LDAP服务的相关信息,例如:
user.manager.impl=ldap
ldap.bind.authenticator.enabled=true
redback.default.admin=sheldonxu
security.policy.password.expiration.enabled=false
ldap.config.hostname=ldap.mydemo.com
ldap.config.port=636
ldap.config.ssl=true
ldap.config.base.dn=o=mydemo.com
ldap.config.context.factory=com.sun.jndi.ldap.LdapCtxFactory
ldap.config.mapper.attribute.email=mail
ldap.config.mapper.attribute.fullname=displayName
ldap.config.mapper.attribute.password=userPassword
ldap.config.mapper.attribute.user.id=uid
ldap.config.mapper.attribute.user.base.dn=ou=People,o=mydemo.com
ldap.config.mapper.attribute.user.object.class=inetOrgPerson
其中各项参数值要根据具体情况而定
3. 如果LDAP服务器使用了SSL (ldaps),要把认证信息加入JRE的keystore
例如:
keytool -import
-alias ldapCert
-file ./ldap.cert
-keystore /usr/lib/jvm/java-6-openjdk/jre/lib/security/cacerts
4. 重启Archiva服务,完成!
posted on 2012-05-28 16:44 Sheldon Xu 阅读(1197) 评论(0) 编辑 收藏 举报