Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
09815cc9
Commit
09815cc9
authored
May 07, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-21352
parents
3ac38fd6
31f9a965
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
10 deletions
+20
-10
LdapProperties.java
...ringframework/boot/autoconfigure/ldap/LdapProperties.java
+6
-5
LdapAutoConfigurationTests.java
...k/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java
+13
-4
build.gradle
spring-boot-project/spring-boot-dependencies/build.gradle
+1
-1
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapProperties.java
View file @
09815cc9
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -56,9 +56,10 @@ public class LdapProperties {
private
String
password
;
/**
* Whether read-only operations should use an anonymous environment.
* Whether read-only operations should use an anonymous environment. Disabled by
* default unless a username is set.
*/
private
b
oolean
anonymousReadOnly
;
private
B
oolean
anonymousReadOnly
;
/**
* LDAP specification settings.
...
...
@@ -97,11 +98,11 @@ public class LdapProperties {
this
.
password
=
password
;
}
public
b
oolean
getAnonymousReadOnly
()
{
public
B
oolean
getAnonymousReadOnly
()
{
return
this
.
anonymousReadOnly
;
}
public
void
setAnonymousReadOnly
(
b
oolean
anonymousReadOnly
)
{
public
void
setAnonymousReadOnly
(
B
oolean
anonymousReadOnly
)
{
this
.
anonymousReadOnly
=
anonymousReadOnly
;
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java
View file @
09815cc9
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -50,7 +50,7 @@ class LdapAutoConfigurationTests {
this
.
contextRunner
.
run
((
context
)
->
{
LdapContextSource
contextSource
=
context
.
getBean
(
LdapContextSource
.
class
);
assertThat
(
contextSource
.
getUrls
()).
containsExactly
(
"ldap://localhost:389"
);
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
is
Fals
e
();
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
is
Tru
e
();
});
}
...
...
@@ -73,6 +73,15 @@ class LdapAutoConfigurationTests {
});
}
@Test
void
contextSourceWithUserDoesNotEnableAnonymousReadOnly
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.ldap.username:root"
).
run
((
context
)
->
{
LdapContextSource
contextSource
=
context
.
getBean
(
LdapContextSource
.
class
);
assertThat
(
contextSource
.
getUserDn
()).
isEqualTo
(
"root"
);
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
isFalse
();
});
}
@Test
void
contextSourceWithExtraCustomization
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.ldap.urls:ldap://localhost:123"
,
"spring.ldap.username:root"
,
...
...
@@ -96,7 +105,7 @@ class LdapAutoConfigurationTests {
LdapContextSource
contextSource
=
context
.
getBean
(
LdapContextSource
.
class
);
assertThat
(
contextSource
.
getUserDn
()).
isEqualTo
(
""
);
assertThat
(
contextSource
.
getPassword
()).
isEqualTo
(
""
);
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
is
Fals
e
();
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
is
Tru
e
();
assertThat
(
contextSource
.
getBaseLdapPathAsString
()).
isEqualTo
(
""
);
});
}
...
...
@@ -112,7 +121,7 @@ class LdapAutoConfigurationTests {
this
.
contextRunner
.
withUserConfiguration
(
PooledContextSourceConfig
.
class
).
run
((
context
)
->
{
LdapContextSource
contextSource
=
context
.
getBean
(
LdapContextSource
.
class
);
assertThat
(
contextSource
.
getUrls
()).
containsExactly
(
"ldap://localhost:389"
);
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
is
Fals
e
();
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
is
Tru
e
();
});
}
...
...
spring-boot-project/spring-boot-dependencies/build.gradle
View file @
09815cc9
...
...
@@ -1662,7 +1662,7 @@ bom {
]
}
}
library
(
"Spring LDAP"
,
"2.3.
2
.RELEASE"
)
{
library
(
"Spring LDAP"
,
"2.3.
3
.RELEASE"
)
{
group
(
"org.springframework.ldap"
)
{
modules
=
[
"spring-ldap-core"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment