February 2019
Intermediate to advanced
442 pages
11h 46m
English
Spring Data provides templates for each of the underlying data providers, like JdbcTemplate, JpaTemplate, MongoTemplate, ElasticSearchTemplate, CassandraTemplate, and so on. The LdapTemplate is the one that is used to communicate with the LDAP server. We will first initialize LdapTemplate. Add the following methods to the LdapDataConfig class:
@Bean("ldapTemplate") public LdapTemplate getLdapTemplate() { return new LdapTemplate(getLdapContextSrc()); } @Bean public ContextSource getLdapContextSrc() { LdapContextSource ldapContextSrc = new LdapContextSource(); ldapContextSrc.setUrl(ldapUrls); ldapContextSrc.setUserDn(ldapManagerUserName); ldapContextSrc.setPassword(ldapManagerPwd); ldapContextSrc.setBase(ldapBase); ...