LDAP之环境建立

Installing Apache Directory Server
1. Go to www.apache.org.
2. Click Directory.
3. Click Download.
4. Click on the suggested mirror site for download.
5. Click apacheds>stable>1.0>1.0 RC3>apacheds-1.0-RC3-win32-setup.exe
6. Save file.
7. Click on the Apache icon and follow the installation instructions.
8. Click Start.
Installing LDAP Browser
1. Go to www.jxplorer.org.
2. Click Downloads>precompiled java package>Windows platform.
3. Save file.
4. Click on the LDAP browser icon and follow the installation instructions.
Inputting User in LDAP Browser
1. Open the LDAP browser.
2. Click File>Connect.
93
3. Change the port to 10389.
4. In the Level drop-down menu, choose User+Password.
5. Insert uid=admin,ou=system in the User DN input field.
6. The password is secret.
7. Click Save and enter a name for the template.
8. Right click on Example and click New.
LDAP Integration
94
9. Add inetorgperson to the Selected Class.
10. User Jane Smith will be added. Enter cn=janesmith in the Enter RDN field and click OK.
11. In the Table Editor enter Smith in the SN line.
12. Enter Jane in the givenName line.
13. For the mail enter janesmith@liferay.com.
14. For the userpassword enter test.
15. Click Submit. 
根据提供的引用内容,建立LDAP连接池的步骤如下: 1. 配置LDAP连接池的上下文环境: ```java Hashtable<String, String> env = new Hashtable<>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://ldap.example.com:389"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, "cn=admin,dc=example,dc=com"); env.put(Context.SECURITY_CREDENTIALS, "password"); ``` 2. 创建LDAP连接池对象: ```java DirContext ctx = new InitialDirContext(env); ``` 3. 配置连接池属性: ```java ctx.addToEnvironment(javax.naming.Context.PROVIDER_URL, "ldap://ldap.example.com:389"); ctx.addToEnvironment(javax.naming.Context.SECURITY_AUTHENTICATION, "simple"); ctx.addToEnvironment(javax.naming.Context.SECURITY_PRINCIPAL, "cn=admin,dc=example,dc=com"); ctx.addToEnvironment(javax.naming.Context.SECURITY_CREDENTIALS, "password"); ctx.addToEnvironment(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); ctx.addToEnvironment(javax.naming.Context.SECURITY_PROTOCOL, "ssl"); ctx.addToEnvironment(javax.naming.Context.SECURITY_PROTOCOL, "tls"); ctx.addToEnvironment(javax.naming.Context.SECURITY_PROTOCOL, "ssl"); ctx.addToEnvironment(javax.naming.Context.SECURITY_PROTOCOL, "ssl"); ``` 4. 创建连接池对象: ```java DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/dbpooling"); ``` 请注意,以上代码仅为示例,实际配置和使用LDAP连接池可能会因环境和需求而有所不同。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值