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
af0bdc89
Commit
af0bdc89
authored
Jan 24, 2018
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for anonymousReadOnly in LdapProperties
See gh-11744
parent
633aefa8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
LdapAutoConfiguration.java
...mework/boot/autoconfigure/ldap/LdapAutoConfiguration.java
+2
-1
LdapProperties.java
...ringframework/boot/autoconfigure/ldap/LdapProperties.java
+14
-1
LdapAutoConfigurationTests.java
...k/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java
+9
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfiguration.java
View file @
af0bdc89
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -58,6 +58,7 @@ public class LdapAutoConfiguration {
...
@@ -58,6 +58,7 @@ public class LdapAutoConfiguration {
source
.
setUrls
(
this
.
properties
.
determineUrls
(
this
.
environment
));
source
.
setUrls
(
this
.
properties
.
determineUrls
(
this
.
environment
));
source
.
setBaseEnvironmentProperties
(
source
.
setBaseEnvironmentProperties
(
Collections
.
unmodifiableMap
(
this
.
properties
.
getBaseEnvironment
()));
Collections
.
unmodifiableMap
(
this
.
properties
.
getBaseEnvironment
()));
source
.
setAnonymousReadOnly
(
this
.
properties
.
getAnonymousReadOnly
());
return
source
;
return
source
;
}
}
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/ldap/LdapProperties.java
View file @
af0bdc89
/*
/*
* Copyright 2012-201
7
the original author or authors.
* Copyright 2012-201
8
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -60,6 +60,11 @@ public class LdapProperties {
...
@@ -60,6 +60,11 @@ public class LdapProperties {
*/
*/
private
Map
<
String
,
String
>
baseEnvironment
=
new
HashMap
<>();
private
Map
<
String
,
String
>
baseEnvironment
=
new
HashMap
<>();
/**
* Whether read-only operations should use an anonymous environment.
*/
private
boolean
anonymousReadOnly
;
public
String
[]
getUrls
()
{
public
String
[]
getUrls
()
{
return
this
.
urls
;
return
this
.
urls
;
}
}
...
@@ -100,6 +105,14 @@ public class LdapProperties {
...
@@ -100,6 +105,14 @@ public class LdapProperties {
this
.
baseEnvironment
=
baseEnvironment
;
this
.
baseEnvironment
=
baseEnvironment
;
}
}
public
boolean
getAnonymousReadOnly
()
{
return
this
.
anonymousReadOnly
;
}
public
void
setAnonymousReadOnly
(
boolean
anonymousReadOnly
)
{
this
.
anonymousReadOnly
=
anonymousReadOnly
;
}
public
String
[]
determineUrls
(
Environment
environment
)
{
public
String
[]
determineUrls
(
Environment
environment
)
{
if
(
ObjectUtils
.
isEmpty
(
this
.
urls
))
{
if
(
ObjectUtils
.
isEmpty
(
this
.
urls
))
{
return
new
String
[]
{
"ldap://localhost:"
+
determinePort
(
environment
)
};
return
new
String
[]
{
"ldap://localhost:"
+
determinePort
(
environment
)
};
...
...
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/ldap/LdapAutoConfigurationTests.java
View file @
af0bdc89
...
@@ -89,4 +89,13 @@ public class LdapAutoConfigurationTests {
...
@@ -89,4 +89,13 @@ public class LdapAutoConfigurationTests {
});
});
}
}
@Test
public
void
testContextSourceWithDefaultAnonymousReadOnly
()
{
this
.
contextRunner
.
withPropertyValues
(
"spring.ldap.urls:ldap://localhost:123"
)
.
run
(
context
->
{
LdapContextSource
contextSource
=
context
.
getBean
(
LdapContextSource
.
class
);
assertThat
(
contextSource
.
isAnonymousReadOnly
()).
isFalse
();
});
}
}
}
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