Skip to content

Commit 1a4f6df

Browse files
committed
Upgrade to Spring Ldap 2.3.3.RELEASE
Closes gh-21342
1 parent 66afe28 commit 1a4f6df

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapProperties.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,9 +56,10 @@ public class LdapProperties {
5656
private String password;
5757

5858
/**
59-
* Whether read-only operations should use an anonymous environment.
59+
* Whether read-only operations should use an anonymous environment. Disabled by
60+
* default unless a username is set.
6061
*/
61-
private boolean anonymousReadOnly;
62+
private Boolean anonymousReadOnly;
6263

6364
/**
6465
* LDAP specification settings.
@@ -97,11 +98,11 @@ public void setPassword(String password) {
9798
this.password = password;
9899
}
99100

100-
public boolean getAnonymousReadOnly() {
101+
public Boolean getAnonymousReadOnly() {
101102
return this.anonymousReadOnly;
102103
}
103104

104-
public void setAnonymousReadOnly(boolean anonymousReadOnly) {
105+
public void setAnonymousReadOnly(Boolean anonymousReadOnly) {
105106
this.anonymousReadOnly = anonymousReadOnly;
106107
}
107108

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@ public void contextSourceWithDefaultUrl() {
4848
LdapContextSource contextSource = context.getBean(LdapContextSource.class);
4949
String[] urls = getUrls(contextSource);
5050
assertThat(urls).containsExactly("ldap://localhost:389");
51-
assertThat(contextSource.isAnonymousReadOnly()).isFalse();
51+
assertThat(contextSource.isAnonymousReadOnly()).isTrue();
5252
});
5353
}
5454

@@ -73,6 +73,15 @@ public void contextSourceWithSeveralUrls() {
7373
});
7474
}
7575

76+
@Test
77+
public void contextSourceWithUserDoesNotEnableAnonymousReadOnly() {
78+
this.contextRunner.withPropertyValues("spring.ldap.username:root").run((context) -> {
79+
LdapContextSource contextSource = context.getBean(LdapContextSource.class);
80+
assertThat(contextSource.getUserDn()).isEqualTo("root");
81+
assertThat(contextSource.isAnonymousReadOnly()).isFalse();
82+
});
83+
}
84+
7685
@Test
7786
public void contextSourceWithExtraCustomization() {
7887
this.contextRunner.withPropertyValues("spring.ldap.urls:ldap://localhost:123", "spring.ldap.username:root",
@@ -96,7 +105,7 @@ public void contextSourceWithNoCustomization() {
96105
LdapContextSource contextSource = context.getBean(LdapContextSource.class);
97106
assertThat(contextSource.getUserDn()).isEqualTo("");
98107
assertThat(contextSource.getPassword()).isEqualTo("");
99-
assertThat(contextSource.isAnonymousReadOnly()).isFalse();
108+
assertThat(contextSource.isAnonymousReadOnly()).isTrue();
100109
assertThat(contextSource.getBaseLdapPathAsString()).isEqualTo("");
101110
});
102111
}
@@ -113,7 +122,7 @@ public void contextSourceWithUserProvidedPooledContextSource() {
113122
LdapContextSource contextSource = context.getBean(LdapContextSource.class);
114123
String[] urls = getUrls(contextSource);
115124
assertThat(urls).containsExactly("ldap://localhost:389");
116-
assertThat(contextSource.isAnonymousReadOnly()).isFalse();
125+
assertThat(contextSource.isAnonymousReadOnly()).isTrue();
117126
});
118127
}
119128

spring-boot-project/spring-boot-dependencies/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
<spring-hateoas.version>0.25.2.RELEASE</spring-hateoas.version>
175175
<spring-integration.version>5.1.10.RELEASE</spring-integration.version>
176176
<spring-kafka.version>2.2.13.RELEASE</spring-kafka.version>
177-
<spring-ldap.version>2.3.2.RELEASE</spring-ldap.version>
177+
<spring-ldap.version>2.3.3.RELEASE</spring-ldap.version>
178178
<spring-plugin.version>1.2.0.RELEASE</spring-plugin.version>
179179
<spring-restdocs.version>2.0.4.RELEASE</spring-restdocs.version>
180180
<spring-retry.version>1.2.5.RELEASE</spring-retry.version>

0 commit comments

Comments
 (0)