利用OpenDS统一管理部门内部的账号(1)
现在要为部门搭建一个绿色的环境,将JIRA、WiKi用统一的账号管理。
服务器选择了tomcat6.0,LDAP选择了OpenDS2.2.0,JDK1.6
由于要的是绿色环境,那么把这些东西全部放在一个文件夹下,希望如果要把环境装到别的机器上,只用把这个文件夹COPY走就行。
目录结构如图:
因此要先配置一下TOMCAT,让tomcat去一个相对路径找JDK,在TOMCAT_HOME/bin 下编辑catalina.bat。在里边加上一句
set JAVA_HOME=..\..\jdk
# add groupdn: ou=Groups,dc=example,dc=comchangetype: addou: Groupsdescription: Group ouobjectClass: topobjectClass: organizationalUnit# add people oudn: ou=People,dc=example,dc=comchangetype: addou: Peopledescription: PeopleobjectClass: topobjectClass: organizationalUnit# add an authorized user (belongs to the group secure)dn: uid=duke,ou=People,dc=example,dc=comchangetype: addobjectClass: topobjectClass: personobjectClass: organizationalPersonobjectClass: inetOrgPersonuid: dukecn: The Dukesn: DukegivenName: TheuserPassword: password# unauthorized userdn: uid=noaccess,ou=People,dc=example,dc=comchangetype: addobjectClass: topobjectClass: personobjectClass: organizationalPersonobjectClass: inetOrgPersonuid: noaccesscn: No Accesssn: accessgivenName: nouserPassword: noaccess# add user to the webapp groupdn: cn=secure,ou=Groups,dc=example,dc=comchangetype: addobjectClass: topobjectClass: groupOfUniqueNamesuniqueMember: uid=duke,ou=People,dc=example,dc=comcn: secure

<Realm className="org.apache.catalina.realm.JNDIRealm" debug="99" connectionName="cn=Directory Manager"connectionPassword="boris" connectionURL="ldap://localhost:389" userPattern="uid={0},ou=people,dc=example,dc=com" roleBase="ou=groups,dc=example,dc=com" roleName="cn" roleSearch="(uniqueMember={0})"/><web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xsi="http://www.w3.org/2001/XMLSchema-instance" schemalocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <security-role> <role-name>secure</role-name> </security-role> <!-- grant access to all users that possess the role 'secure' and deny all others --> <security-constraint> <web-resource-collection> <web-resource-name>opendsauthtest</web-resource-name> <url-pattern>/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>secure</role-name> </auth-constraint> </security-constraint> <!-- declare the app uses FORM based authentication using your newly created OpenDS realm --> <login-config> <auth-method>BASIC</auth-method> <realm-name>OpenDS</realm-name> </login-config> </web-app>