差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
下次修改 Both sides next revision
java:ldap [2016/03/25 22:19]
tony [Spring - LDAP]
java:ldap [2016/04/26 15:20]
tony [SunCertPathBuilderException]
行 1: 行 1:
 +{{tag>​ldap}}
 ====== LDAP & AD ====== ====== LDAP & AD ======
 LDAP & AD都算是老東西了,會開始寫些教學是因為遇到與它的整合。內容隨著我的學習會慢慢增加,如果我有空寫的話~XD。 LDAP & AD都算是老東西了,會開始寫些教學是因為遇到與它的整合。內容隨著我的學習會慢慢增加,如果我有空寫的話~XD。
行 27: 行 28:
 <code bash> <code bash>
 ./keytool -delete -keystore /​opt/​jdk1.8.0_60/​jre/​lib/​security/​cacerts -storepass changeit -alias tonytest ./keytool -delete -keystore /​opt/​jdk1.8.0_60/​jre/​lib/​security/​cacerts -storepass changeit -alias tonytest
 +</​code>​
 +修改密碼:​
 +<code bash>
 +keytool -keystore "​C:​\Program Files\Java\jre1.8.0_66\lib\security\cacerts"​ -storepasswd -new newpasswd -storepass changeit
 </​code>​ </​code>​
 ===== TLS already started ===== ===== TLS already started =====
行 35: 行 40:
 </​code>​ </​code>​
 會出現這問題,也有可能你是使用ldaps+636 port去做存取而產生的。(reference [[http://​forum.spring.io/​forum/​spring-projects/​data/​ldap/​19764-tls-and-setupauthenticatedenvironment|link]]) 會出現這問題,也有可能你是使用ldaps+636 port去做存取而產生的。(reference [[http://​forum.spring.io/​forum/​spring-projects/​data/​ldap/​19764-tls-and-setupauthenticatedenvironment|link]])
-===== Test Spring API ===== 
-<code java> 
-public class Tester { 
- 
- public static void main(String[] args) { 
- try { 
- LdapContextSource contextSource = new LdapContextSource();​ 
- //​contextSource.setUrl("​ldap://​superserver.tony.org:​389"​);​ 
- //​contextSource.setUrl("​ldap://​superserver.tony.org:​389"​);​ 
- contextSource.setUrl("​ldap://​10.134.15.131:​389"​);​ 
- contextSource.setBase("​DC=tony,​DC=org"​);​ 
- contextSource.setUserDn("​CN=admin,​DC=tony,​DC=org"​);​ 
- contextSource.setPassword("​123456"​);​ 
- contextSource.afterPropertiesSet();​ 
-  
- DefaultTlsDirContextAuthenticationStrategy strategy = new DefaultTlsDirContextAuthenticationStrategy(){ 
- @Override 
- protected void applyAuthentication(LdapContext ctx, String userDn, String password) 
- throws NamingException { 
- super.applyAuthentication(ctx,​ userDn, password); 
- ctx.addToEnvironment("​com.sun.jndi.ldap.read.timeout",​ "​20000"​);​ 
- } 
- }; 
-  
- strategy.setHostnameVerifier(new HostnameVerifier() { 
-  
- @Override 
- public boolean verify(String paramString,​ SSLSession paramSSLSession) { 
- System.out.println("​ignore verify"​);​ 
- return true; 
- } 
- }); 
-  
- contextSource.setAuthenticationStrategy(strategy);​ 
-  
-  
- LdapTemplate ldapTemplate = new LdapTemplate(contextSource);​ 
- ldapTemplate.afterPropertiesSet();​ 
-  
-  
- Filter filter = new EqualsFilter("​uid",​ "​tonylin"​);​ 
- 
- boolean authed = ldapTemplate.authenticate("​ou=supermicro",​ filter.encode(),​ "​123456"​);​ 
- 
- System.out.println("​Authenticated:​ " + authed); 
- } catch (Exception e) { 
- e.printStackTrace();​ 
- } finally { 
- ThreadUtil.sleep(15000);​ 
- } 
- } 
- 
-} 
-</​code>​ 
  
 ===== Articles ===== ===== Articles =====
   * [[java:​ldap:​openldap|OpenLDAP]]   * [[java:​ldap:​openldap|OpenLDAP]]
 +  * [[java:​ldap:​jndi|JNDI API]]
 +  * [[java:​ldap:​spring|Spring API]]
 +  * [[java:​dalp:​ad:​enable_certificate|Enable SSL/TLS on Windows AD]]
 ===== Reference ===== ===== Reference =====
 ==== Auth & Security ==== ==== Auth & Security ====
行 105: 行 59:
   * [[https://​directory.apache.org/​studio/​downloads.html|Apache Directory Studio]]   * [[https://​directory.apache.org/​studio/​downloads.html|Apache Directory Studio]]
   * [[http://​www.ldapadmin.org/​|LDAP Admin]] ​   * [[http://​www.ldapadmin.org/​|LDAP Admin]] ​
 +==== Integration ====
 +  * [[http://​media.community.dell.com/​en/​dtc/​attach/​idrac6_directoryservices.pdf|Dell iDRAC6]]
 +
 +=====  =====
 +----
 +\\
 +~~DISQUS~~