差異處

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

連向這個比對檢視

java:ldap:spring [2016/05/06 00:15]
tony [To Do]
java:ldap:spring [2023/06/25 09:48]
行 1: 行 1:
-{{tag>​ldap spring spring-ldap spring-security}} +
-====== LDAP with Spring API ====== +
-===== Articles ===== +
-  * [[java:​ldap:​spring:​simpleAuthentication|Simple Authentication]] SSL and StartTLS +
-  * [[java:​ldap:​spring:​object-relation|Spring-Security with LDAP物件關係]] +
-  * [[java:​ldap:​spring:​supportSAMOfADProvider|Support SAM-Account-Name of AD Provider]] +
-==== Search AD User and Groups ==== +
-<code java> +
- LdapContextSource contextSource = new DefaultSpringSecurityContextSource("​ldap://​10.134.15.138:​389"​);​ +
- contextSource.setBase("​DC=TEST,​DC=SSM"​);​ +
- contextSource.setUserDn("​test@TEST.SSM"​);​ +
- contextSource.setPassword("​123456"​);​ +
- DirContextAuthenticationStrategy strategy = createTLSStrategy();​ +
- contextSource.setAuthenticationStrategy(strategy);​ +
- contextSource.afterPropertiesSet();​ +
-  +
- LdapTemplate ldapTemplate = new LdapTemplate(contextSource);​ +
- ldapTemplate.afterPropertiesSet();​ +
-  +
- SearchControls sc = new SearchControls();​ +
- sc.setSearchScope(SearchControls.SUBTREE_SCOPE);​ +
-  +
- ldapTemplate.search("​cn=Users",​ "​(objectclass=group)",​ sc, new NameClassPairCallbackHandler() { +
-  +
- @Override +
- public void handleNameClassPair(NameClassPair nameClassPair) { +
- System.out.println(nameClassPair.getName());​ +
-+
- }); +
-</​code>​ +
-===== To Do ===== +
-  * Write: AD Provider支援TLS。 +
-  * Write: LDAP Provider Login with anonymous支援TLS。 +
-  * Write: SSL with HostVerifier。 +
-  * Write: Login LDAP with FullDN。 +
-  * Study: Connection Pool for TLS。 +
-===== Resource ===== +
-  * [[http://​stackoverflow.com/​questions/​32501853/​catch-communicationexception-from-spring-security|catch-communicationexception-from-spring-security]] +
-  * [[http://​docs.spring.io/​spring-ldap/​docs/​current/​reference/#​introduction|spring-ldap docs]]+