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
a8726c4a
Commit
a8726c4a
authored
Feb 12, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.1.x'
parents
a4b4b850
d7ae0f3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
ManagementSecurityAutoConfiguration.java
...te/autoconfigure/ManagementSecurityAutoConfiguration.java
+4
-2
JolokiaMvcEndpoint.java
...amework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java
+3
-2
ManagementSecurityAutoConfigurationTests.java
...toconfigure/ManagementSecurityAutoConfigurationTests.java
+12
-3
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfiguration.java
View file @
a8726c4a
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
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.
...
...
@@ -75,6 +75,7 @@ import org.springframework.util.StringUtils;
* used as a security hint by the filter created here.
*
* @author Dave Syer
* @author Andy Wilkinson
*/
@Configuration
@ConditionalOnWebApplication
...
...
@@ -276,8 +277,9 @@ public class ManagementSecurityAutoConfiguration {
if
(
endpoint
.
isSensitive
()
==
secure
)
{
String
path
=
endpointHandlerMapping
.
getPath
(
endpoint
.
getPath
());
paths
.
add
(
path
);
// Ensure that nested paths are secured
paths
.
add
(
path
+
"/**"
);
// Add Spring MVC-generated additional paths
paths
.
add
(
path
+
"/"
);
paths
.
add
(
path
+
".*"
);
}
}
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java
View file @
a8726c4a
/*
* Copyright 2013-201
4
the original author or authors.
* Copyright 2013-201
5
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.
...
...
@@ -42,6 +42,7 @@ import org.springframework.web.util.UrlPathHelper;
* {@link MvcEndpoint} to expose Jolokia.
*
* @author Christian Dupuis
* @author Andy Wilkinson
*/
@ConfigurationProperties
(
prefix
=
"endpoints.jolokia"
,
ignoreUnknownFields
=
false
)
public
class
JolokiaMvcEndpoint
implements
MvcEndpoint
,
InitializingBean
,
...
...
@@ -57,7 +58,7 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean,
/**
* Enable security on the endpoint.
*/
private
boolean
sensitive
;
private
boolean
sensitive
=
true
;
/**
* Enable the endpoint.
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfigurationTests.java
View file @
a8726c4a
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
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.
...
...
@@ -41,14 +41,18 @@ import org.springframework.test.util.ReflectionTestUtils;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.context.support.AnnotationConfigWebApplicationContext
;
import
static
org
.
hamcrest
.
Matchers
.
greaterThan
;
import
static
org
.
hamcrest
.
Matchers
.
hasSize
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
/**
* Tests for {@link ManagementSecurityAutoConfiguration}.
*
* @author Dave Syer
* @author Andy Wilkinson
*/
public
class
ManagementSecurityAutoConfigurationTests
{
...
...
@@ -71,11 +75,16 @@ public class ManagementSecurityAutoConfigurationTests {
EndpointAutoConfiguration
.
class
,
EndpointWebMvcAutoConfiguration
.
class
,
ManagementServerPropertiesAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
);
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"security.basic.enabled:false"
);
this
.
context
.
refresh
();
assertNotNull
(
this
.
context
.
getBean
(
AuthenticationManagerBuilder
.
class
));
FilterChainProxy
filterChainProxy
=
this
.
context
.
getBean
(
FilterChainProxy
.
class
);
// 4 for static resources, one for management endpoints and one for the rest
assertEquals
(
6
,
this
.
context
.
getBean
(
FilterChainProxy
.
class
).
getFilterChains
()
.
size
());
assertThat
(
filterChainProxy
.
getFilterChains
(),
hasSize
(
6
));
assertThat
(
filterChainProxy
.
getFilters
(
"/beans"
),
hasSize
(
greaterThan
(
0
)));
assertThat
(
filterChainProxy
.
getFilters
(
"/beans/"
),
hasSize
(
greaterThan
(
0
)));
assertThat
(
filterChainProxy
.
getFilters
(
"/beans.foo"
),
hasSize
(
greaterThan
(
0
)));
assertThat
(
filterChainProxy
.
getFilters
(
"/beans/foo/bar"
),
hasSize
(
greaterThan
(
0
)));
}
@Test
...
...
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