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
43d432a5
Commit
43d432a5
authored
Jan 18, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
d1a8d136
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
25 deletions
+34
-25
HealthIndicatorAutoConfiguration.java
...tuate/autoconfigure/HealthIndicatorAutoConfiguration.java
+2
-1
LdapHealthIndicator.java
...ingframework/boot/actuate/health/LdapHealthIndicator.java
+1
-0
HealthIndicatorAutoConfigurationTests.java
.../autoconfigure/HealthIndicatorAutoConfigurationTests.java
+4
-4
LdapHealthIndicatorTests.java
...amework/boot/actuate/health/LdapHealthIndicatorTests.java
+10
-8
LdapRepositoriesAutoConfiguration.java
...onfigure/data/ldap/LdapRepositoriesAutoConfiguration.java
+1
-2
SecurityProperties.java
...ework/boot/autoconfigure/security/SecurityProperties.java
+2
-2
DefaultUserInfoRestTemplateFactory.java
...y/oauth2/resource/DefaultUserInfoRestTemplateFactory.java
+3
-1
ResourceServerTokenServicesConfiguration.java
...h2/resource/ResourceServerTokenServicesConfiguration.java
+2
-1
RepositoryRestMvcAutoConfigurationTests.java
...re/data/rest/RepositoryRestMvcAutoConfigurationTests.java
+6
-3
ResourceServerTokenServicesConfigurationTests.java
...source/ResourceServerTokenServicesConfigurationTests.java
+3
-3
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java
View file @
43d432a5
...
@@ -244,7 +244,8 @@ public class HealthIndicatorAutoConfiguration {
...
@@ -244,7 +244,8 @@ public class HealthIndicatorAutoConfiguration {
private
final
Map
<
String
,
LdapOperations
>
ldapOperations
;
private
final
Map
<
String
,
LdapOperations
>
ldapOperations
;
public
LdapHealthIndicatorConfiguration
(
Map
<
String
,
LdapOperations
>
ldapOperations
)
{
public
LdapHealthIndicatorConfiguration
(
Map
<
String
,
LdapOperations
>
ldapOperations
)
{
this
.
ldapOperations
=
ldapOperations
;
this
.
ldapOperations
=
ldapOperations
;
}
}
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/LdapHealthIndicator.java
View file @
43d432a5
...
@@ -57,6 +57,7 @@ public class LdapHealthIndicator extends AbstractHealthIndicator {
...
@@ -57,6 +57,7 @@ public class LdapHealthIndicator extends AbstractHealthIndicator {
}
}
return
null
;
return
null
;
}
}
}
}
}
}
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfigurationTests.java
View file @
43d432a5
...
@@ -541,8 +541,8 @@ public class HealthIndicatorAutoConfigurationTests {
...
@@ -541,8 +541,8 @@ public class HealthIndicatorAutoConfigurationTests {
public
void
ldapHealthIndicator
()
throws
Exception
{
public
void
ldapHealthIndicator
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"management.health.diskspace.enabled:false"
);
"management.health.diskspace.enabled:false"
);
this
.
context
.
register
(
LdapConfiguration
.
class
,
this
.
context
.
register
(
LdapConfiguration
.
class
,
ManagementServerProperties
.
class
,
ManagementServerProperties
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
HealthIndicatorAutoConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
.
getBeansOfType
(
HealthIndicator
.
class
);
...
@@ -556,8 +556,8 @@ public class HealthIndicatorAutoConfigurationTests {
...
@@ -556,8 +556,8 @@ public class HealthIndicatorAutoConfigurationTests {
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"management.health.diskspace.enabled:false"
,
"management.health.diskspace.enabled:false"
,
"management.health.ldap.enabled:false"
);
"management.health.ldap.enabled:false"
);
this
.
context
.
register
(
LdapConfiguration
.
class
,
this
.
context
.
register
(
LdapConfiguration
.
class
,
ManagementServerProperties
.
class
,
ManagementServerProperties
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
HealthIndicatorAutoConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
Map
<
String
,
HealthIndicator
>
beans
=
this
.
context
.
getBeansOfType
(
HealthIndicator
.
class
);
.
getBeansOfType
(
HealthIndicator
.
class
);
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/health/LdapHealthIndicatorTests.java
View file @
43d432a5
...
@@ -62,31 +62,33 @@ public class LdapHealthIndicatorTests {
...
@@ -62,31 +62,33 @@ public class LdapHealthIndicatorTests {
this
.
context
.
register
(
LdapAutoConfiguration
.
class
,
this
.
context
.
register
(
LdapAutoConfiguration
.
class
,
LdapDataAutoConfiguration
.
class
,
LdapDataAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
EndpointAutoConfiguration
.
class
,
EndpointAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
);
HealthIndicatorAutoConfiguration
.
class
);
this
.
context
.
refresh
();
this
.
context
.
refresh
();
LdapTemplate
ldapTemplate
=
this
.
context
.
getBean
(
LdapTemplate
.
class
);
LdapTemplate
ldapTemplate
=
this
.
context
.
getBean
(
LdapTemplate
.
class
);
assertThat
(
ldapTemplate
).
isNotNull
();
assertThat
(
ldapTemplate
).
isNotNull
();
LdapHealthIndicator
healthIndicator
=
this
.
context
.
getBean
(
LdapHealthIndicator
healthIndicator
=
this
.
context
LdapHealthIndicator
.
class
);
.
getBean
(
LdapHealthIndicator
.
class
);
assertThat
(
healthIndicator
).
isNotNull
();
assertThat
(
healthIndicator
).
isNotNull
();
}
}
@Test
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
ldapIsUp
()
{
public
void
ldapIsUp
()
{
LdapTemplate
ldapTemplate
=
mock
(
LdapTemplate
.
class
);
LdapTemplate
ldapTemplate
=
mock
(
LdapTemplate
.
class
);
given
(
ldapTemplate
.
executeReadOnly
(
any
(
ContextExecutor
.
class
))).
willReturn
(
"3"
);
given
(
ldapTemplate
.
executeReadOnly
((
ContextExecutor
<
String
>)
any
()))
.
willReturn
(
"3"
);
LdapHealthIndicator
healthIndicator
=
new
LdapHealthIndicator
(
ldapTemplate
);
LdapHealthIndicator
healthIndicator
=
new
LdapHealthIndicator
(
ldapTemplate
);
Health
health
=
healthIndicator
.
health
();
Health
health
=
healthIndicator
.
health
();
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UP
);
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
UP
);
assertThat
(
health
.
getDetails
().
get
(
"version"
)).
isEqualTo
(
"3"
);
assertThat
(
health
.
getDetails
().
get
(
"version"
)).
isEqualTo
(
"3"
);
verify
(
ldapTemplate
).
executeReadOnly
(
any
(
ContextExecutor
.
class
));
verify
(
ldapTemplate
).
executeReadOnly
(
(
ContextExecutor
<
String
>)
any
(
));
}
}
@Test
@Test
@SuppressWarnings
(
"unchecked"
)
public
void
ldapIsDown
()
{
public
void
ldapIsDown
()
{
LdapTemplate
ldapTemplate
=
mock
(
LdapTemplate
.
class
);
LdapTemplate
ldapTemplate
=
mock
(
LdapTemplate
.
class
);
given
(
ldapTemplate
.
executeReadOnly
(
any
(
ContextExecutor
.
class
)))
given
(
ldapTemplate
.
executeReadOnly
(
(
ContextExecutor
<
String
>)
any
(
)))
.
willThrow
(
new
CommunicationException
(
.
willThrow
(
new
CommunicationException
(
new
javax
.
naming
.
CommunicationException
(
"Connection failed"
)));
new
javax
.
naming
.
CommunicationException
(
"Connection failed"
)));
LdapHealthIndicator
healthIndicator
=
new
LdapHealthIndicator
(
ldapTemplate
);
LdapHealthIndicator
healthIndicator
=
new
LdapHealthIndicator
(
ldapTemplate
);
...
@@ -94,7 +96,7 @@ public class LdapHealthIndicatorTests {
...
@@ -94,7 +96,7 @@ public class LdapHealthIndicatorTests {
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
DOWN
);
assertThat
(
health
.
getStatus
()).
isEqualTo
(
Status
.
DOWN
);
assertThat
((
String
)
health
.
getDetails
().
get
(
"error"
))
assertThat
((
String
)
health
.
getDetails
().
get
(
"error"
))
.
contains
(
"Connection failed"
);
.
contains
(
"Connection failed"
);
verify
(
ldapTemplate
).
executeReadOnly
(
any
(
ContextExecutor
.
class
));
verify
(
ldapTemplate
).
executeReadOnly
(
(
ContextExecutor
<
String
>)
any
(
));
}
}
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/ldap/LdapRepositoriesAutoConfiguration.java
View file @
43d432a5
...
@@ -28,8 +28,7 @@ import org.springframework.data.ldap.repository.LdapRepository;
...
@@ -28,8 +28,7 @@ import org.springframework.data.ldap.repository.LdapRepository;
import
org.springframework.data.ldap.repository.support.LdapRepositoryFactoryBean
;
import
org.springframework.data.ldap.repository.support.LdapRepositoryFactoryBean
;
/**
/**
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's LDAP
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's LDAP Repositories.
* Repositories.
*
*
* @author Eddú Meléndez
* @author Eddú Meléndez
* @since 1.5.0
* @since 1.5.0
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java
View file @
43d432a5
...
@@ -48,8 +48,8 @@ public class SecurityProperties implements SecurityPrerequisite {
...
@@ -48,8 +48,8 @@ public class SecurityProperties implements SecurityPrerequisite {
/**
/**
* Order applied to the WebSecurityConfigurerAdapter that is used to configure basic
* Order applied to the WebSecurityConfigurerAdapter that is used to configure basic
* authentication for application endpoints. If you want to add your own
* authentication for application endpoints. If you want to add your own
* authentication for all or some of those endpoints the best thing to do is to add
your
* authentication for all or some of those endpoints the best thing to do is to add
* own WebSecurityConfigurerAdapter with lower order.
*
your
own WebSecurityConfigurerAdapter with lower order.
*/
*/
public
static
final
int
BASIC_AUTH_ORDER
=
Ordered
.
LOWEST_PRECEDENCE
-
5
;
public
static
final
int
BASIC_AUTH_ORDER
=
Ordered
.
LOWEST_PRECEDENCE
-
5
;
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/DefaultUserInfoRestTemplateFactory.java
View file @
43d432a5
...
@@ -66,11 +66,13 @@ public class DefaultUserInfoRestTemplateFactory implements UserInfoRestTemplateF
...
@@ -66,11 +66,13 @@ public class DefaultUserInfoRestTemplateFactory implements UserInfoRestTemplateF
this
.
oauth2ClientContext
=
oauth2ClientContext
.
getIfAvailable
();
this
.
oauth2ClientContext
=
oauth2ClientContext
.
getIfAvailable
();
}
}
@Override
public
OAuth2RestTemplate
getUserInfoRestTemplate
()
{
public
OAuth2RestTemplate
getUserInfoRestTemplate
()
{
if
(
this
.
oauth2RestTemplate
==
null
)
{
if
(
this
.
oauth2RestTemplate
==
null
)
{
this
.
oauth2RestTemplate
=
createOAuth2RestTemplate
(
this
.
oauth2RestTemplate
=
createOAuth2RestTemplate
(
this
.
details
==
null
?
DEFAULT_RESOURCE_DETAILS
:
this
.
details
);
this
.
details
==
null
?
DEFAULT_RESOURCE_DETAILS
:
this
.
details
);
this
.
oauth2RestTemplate
.
getInterceptors
().
add
(
new
AcceptJsonRequestInterceptor
());
this
.
oauth2RestTemplate
.
getInterceptors
()
.
add
(
new
AcceptJsonRequestInterceptor
());
AuthorizationCodeAccessTokenProvider
accessTokenProvider
=
new
AuthorizationCodeAccessTokenProvider
();
AuthorizationCodeAccessTokenProvider
accessTokenProvider
=
new
AuthorizationCodeAccessTokenProvider
();
accessTokenProvider
.
setTokenRequestEnhancer
(
new
AcceptJsonRequestEnhancer
());
accessTokenProvider
.
setTokenRequestEnhancer
(
new
AcceptJsonRequestEnhancer
());
this
.
oauth2RestTemplate
.
setAccessTokenProvider
(
accessTokenProvider
);
this
.
oauth2RestTemplate
.
setAccessTokenProvider
(
accessTokenProvider
);
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfiguration.java
View file @
43d432a5
...
@@ -88,7 +88,8 @@ public class ResourceServerTokenServicesConfiguration {
...
@@ -88,7 +88,8 @@ public class ResourceServerTokenServicesConfiguration {
ObjectProvider
<
List
<
UserInfoRestTemplateCustomizer
>>
customizers
,
ObjectProvider
<
List
<
UserInfoRestTemplateCustomizer
>>
customizers
,
ObjectProvider
<
OAuth2ProtectedResourceDetails
>
details
,
ObjectProvider
<
OAuth2ProtectedResourceDetails
>
details
,
ObjectProvider
<
OAuth2ClientContext
>
oauth2ClientContext
)
{
ObjectProvider
<
OAuth2ClientContext
>
oauth2ClientContext
)
{
return
new
DefaultUserInfoRestTemplateFactory
(
customizers
,
details
,
oauth2ClientContext
);
return
new
DefaultUserInfoRestTemplateFactory
(
customizers
,
details
,
oauth2ClientContext
);
}
}
@Configuration
@Configuration
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java
View file @
43d432a5
...
@@ -222,13 +222,16 @@ public class RepositoryRestMvcAutoConfigurationTests {
...
@@ -222,13 +222,16 @@ public class RepositoryRestMvcAutoConfigurationTests {
}
}
static
class
TestRepositoryRestConfigurer
extends
RepositoryRestConfigurerAdapter
{
static
class
TestRepositoryRestConfigurer
extends
RepositoryRestConfigurerAdapter
{
@Override
@Override
public
void
configureRepositoryRestConfiguration
(
RepositoryRestConfiguration
config
)
{
public
void
configureRepositoryRestConfiguration
(
RepositoryRestConfiguration
config
)
{
config
.
setRepositoryDetectionStrategy
(
RepositoryDetectionStrategies
.
ALL
);
config
.
setRepositoryDetectionStrategy
(
RepositoryDetectionStrategies
.
ALL
);
config
.
setDefaultMediaType
(
MediaType
.
parseMediaType
(
config
.
setDefaultMediaType
(
"application/my-custom-json"
));
MediaType
.
parseMediaType
(
"application/my-custom-json"
));
config
.
setMaxPageSize
(
78
);
config
.
setMaxPageSize
(
78
);
}
}
}
}
}
}
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/resource/ResourceServerTokenServicesConfigurationTests.java
View file @
43d432a5
...
@@ -220,7 +220,7 @@ public class ResourceServerTokenServicesConfigurationTests {
...
@@ -220,7 +220,7 @@ public class ResourceServerTokenServicesConfigurationTests {
"security.oauth2.resource.userInfoUri:http://example.com"
);
"security.oauth2.resource.userInfoUri:http://example.com"
);
this
.
context
=
new
SpringApplicationBuilder
(
this
.
context
=
new
SpringApplicationBuilder
(
CustomUserInfoRestTemplateFactory
.
class
,
ResourceConfiguration
.
class
)
CustomUserInfoRestTemplateFactory
.
class
,
ResourceConfiguration
.
class
)
.
environment
(
this
.
environment
).
web
(
false
).
run
();
.
environment
(
this
.
environment
).
web
(
false
).
run
();
assertThat
(
this
.
context
.
getBeansOfType
(
UserInfoRestTemplateFactory
.
class
))
assertThat
(
this
.
context
.
getBeansOfType
(
UserInfoRestTemplateFactory
.
class
))
.
hasSize
(
1
);
.
hasSize
(
1
);
assertThat
(
this
.
context
.
getBean
(
UserInfoRestTemplateFactory
.
class
))
assertThat
(
this
.
context
.
getBean
(
UserInfoRestTemplateFactory
.
class
))
...
@@ -331,8 +331,8 @@ public class ResourceServerTokenServicesConfigurationTests {
...
@@ -331,8 +331,8 @@ public class ResourceServerTokenServicesConfigurationTests {
protected
static
class
CustomUserInfoRestTemplateFactory
protected
static
class
CustomUserInfoRestTemplateFactory
implements
UserInfoRestTemplateFactory
{
implements
UserInfoRestTemplateFactory
{
private
final
OAuth2RestTemplate
restTemplate
=
private
final
OAuth2RestTemplate
restTemplate
=
new
OAuth2RestTemplate
(
new
OAuth2RestTemplate
(
new
AuthorizationCodeResourceDetails
());
new
AuthorizationCodeResourceDetails
());
@Override
@Override
public
OAuth2RestTemplate
getUserInfoRestTemplate
()
{
public
OAuth2RestTemplate
getUserInfoRestTemplate
()
{
...
...
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