|
|
@ -39,7 +39,7 @@ public class LdapAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void contextSourceWithDefaultUrl() {
|
|
|
|
public void contextSourceWithDefaultUrl() {
|
|
|
|
this.contextRunner.run(context -> {
|
|
|
|
this.contextRunner.run((context) -> {
|
|
|
|
LdapContextSource contextSource = context.getBean(LdapContextSource.class);
|
|
|
|
LdapContextSource contextSource = context.getBean(LdapContextSource.class);
|
|
|
|
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
|
|
|
|
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
|
|
|
|
"urls");
|
|
|
|
"urls");
|
|
|
@ -51,7 +51,7 @@ public class LdapAutoConfigurationTests {
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void contextSourceWithSingleUrl() {
|
|
|
|
public void contextSourceWithSingleUrl() {
|
|
|
|
this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:123")
|
|
|
|
this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:123")
|
|
|
|
.run(context -> {
|
|
|
|
.run((context) -> {
|
|
|
|
ContextSource contextSource = context.getBean(ContextSource.class);
|
|
|
|
ContextSource contextSource = context.getBean(ContextSource.class);
|
|
|
|
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
|
|
|
|
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
|
|
|
|
"urls");
|
|
|
|
"urls");
|
|
|
@ -64,7 +64,7 @@ public class LdapAutoConfigurationTests {
|
|
|
|
this.contextRunner
|
|
|
|
this.contextRunner
|
|
|
|
.withPropertyValues(
|
|
|
|
.withPropertyValues(
|
|
|
|
"spring.ldap.urls:ldap://localhost:123,ldap://mycompany:123")
|
|
|
|
"spring.ldap.urls:ldap://localhost:123,ldap://mycompany:123")
|
|
|
|
.run(context -> {
|
|
|
|
.run((context) -> {
|
|
|
|
ContextSource contextSource = context.getBean(ContextSource.class);
|
|
|
|
ContextSource contextSource = context.getBean(ContextSource.class);
|
|
|
|
LdapProperties ldapProperties = context.getBean(LdapProperties.class);
|
|
|
|
LdapProperties ldapProperties = context.getBean(LdapProperties.class);
|
|
|
|
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
|
|
|
|
String[] urls = (String[]) ReflectionTestUtils.getField(contextSource,
|
|
|
@ -83,7 +83,7 @@ public class LdapAutoConfigurationTests {
|
|
|
|
"spring.ldap.anonymous-read-only:true",
|
|
|
|
"spring.ldap.anonymous-read-only:true",
|
|
|
|
"spring.ldap.base:cn=SpringDevelopers",
|
|
|
|
"spring.ldap.base:cn=SpringDevelopers",
|
|
|
|
"spring.ldap.baseEnvironment.java.naming.security.authentication:DIGEST-MD5")
|
|
|
|
"spring.ldap.baseEnvironment.java.naming.security.authentication:DIGEST-MD5")
|
|
|
|
.run(context -> {
|
|
|
|
.run((context) -> {
|
|
|
|
LdapContextSource contextSource = context
|
|
|
|
LdapContextSource contextSource = context
|
|
|
|
.getBean(LdapContextSource.class);
|
|
|
|
.getBean(LdapContextSource.class);
|
|
|
|
assertThat(contextSource.getUserDn()).isEqualTo("root");
|
|
|
|
assertThat(contextSource.getUserDn()).isEqualTo("root");
|
|
|
|