EmbeddedLdapAutoConfiguration not setting the base information into the LdapContextSource
See original GitHub issueCurrently (as of version 2.0.0.M7), EmbeddedLdapAutoConfiguration isn’t properly setting the base information from LdapContextSource using the value from spring.ldap.embedded.base-dn.
Because of that, we can’t test our @repository classes using an embedded LDAP server without overriding this bean unless if we want to set the whole path for each @Entry.
I would suggest the following change inside of org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration#ldapContextSource:
@Bean
@DependsOn("directoryServer")
@ConditionalOnMissingBean
public ContextSource ldapContextSource() {
LdapContextSource source = new LdapContextSource();
if (hasCredentials(this.embeddedProperties.getCredential())) {
source.setUserDn(this.embeddedProperties.getCredential().getUsername());
source.setPassword(this.embeddedProperties.getCredential().getPassword());
}
source.setBase(this.embeddedProperties.getBaseDn()); // Add this line.
source.setUrls(this.properties.determineUrls(this.environment));
return source;
}
This issue was already reported in the issue #10443 which was closed without fixing the problem.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Spring LDAP Spring Ldap Embedded doesn't set ...
I got around this with the following: @Bean public LdapContextSource createLdapConfig(LdapProperties properties, Environment environment, ...
Read more >Spring LDAP Reference
Spring LDAP makes it easier to build Spring-based applications ... information on how the library helps when working with LdapName objects.
Read more >Java Examples for org.springframework.ldap.core.support ...
This java examples will help you to understand the usage of org.springframework.ldap.core.support.LdapContextSource. These source code samples are taken ...
Read more >Spring Boot Reference Guide
Exposing YAML as Properties in the Spring Environment . ... Converting Data Sizes . ... An LdapContextSource is auto-configured based on these settings....
Read more >Spring LDAP Overview - Baeldung
When we are working on a Spring Boot project, we can use Spring Boot Starter Data Ldap dependency that will automatically instrument ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It hasn’t progressed because the proposal was unsatisfactory. But you’re right, looking back at the history, we could use a report for this. Let’s use this one then.
Ok, so because PR #10444 was made to fix Issue #10443, you closed the issue as a duplicate of the PR. Then, you closed PR #10444 which isn’t progressing since then. And now you closed this ticket which report back the problem as a bug. Meaning that there isn’t even an opened ticket to signal the bug.
Would you mind reopening at least one ticket so that someone could find it and try working on it? Unless there is another opened ticket of which I am unaware?