Reuse spring.ldap.base in Embedded support
Closes gh-10444
This commit is contained in:
parent
5a13a32f6c
commit
0fbc5def32
|
|
@ -98,6 +98,7 @@ public class EmbeddedLdapAutoConfiguration {
|
||||||
source.setPassword(this.embeddedProperties.getCredential().getPassword());
|
source.setPassword(this.embeddedProperties.getCredential().getPassword());
|
||||||
}
|
}
|
||||||
source.setUrls(this.properties.determineUrls(this.environment));
|
source.setUrls(this.properties.determineUrls(this.environment));
|
||||||
|
source.setBase(this.properties.getBase());
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,21 @@ public class EmbeddedLdapAutoConfigurationTests {
|
||||||
assertThat(ldapTemplate.list("ou=company1,c=Sweden,dc=spring,dc=org")).hasSize(4);
|
assertThat(ldapTemplate.list("ou=company1,c=Sweden,dc=spring,dc=org")).hasSize(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQueryEmbeddedLdapWithBase() throws LDAPException {
|
||||||
|
TestPropertyValues.of("spring.ldap.embedded.base-dn:dc=spring,dc=org",
|
||||||
|
"spring.ldap.base:dc=spring,dc=org")
|
||||||
|
.applyTo(this.context);
|
||||||
|
this.context.register(EmbeddedLdapAutoConfiguration.class,
|
||||||
|
LdapAutoConfiguration.class, LdapDataAutoConfiguration.class,
|
||||||
|
PropertyPlaceholderAutoConfiguration.class);
|
||||||
|
this.context.refresh();
|
||||||
|
assertThat(this.context.getBeanNamesForType(LdapTemplate.class).length)
|
||||||
|
.isEqualTo(1);
|
||||||
|
LdapTemplate ldapTemplate = this.context.getBean(LdapTemplate.class);
|
||||||
|
assertThat(ldapTemplate.list("ou=company1,c=Sweden")).hasSize(4);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDisableSchemaValidation() throws LDAPException {
|
public void testDisableSchemaValidation() throws LDAPException {
|
||||||
load("spring.ldap.embedded.validation.enabled:false",
|
load("spring.ldap.embedded.validation.enabled:false",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue