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
3546ae39
Commit
3546ae39
authored
May 27, 2016
by
Alex Antonov
Committed by
Andy Wilkinson
Jun 27, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow management server SSL to be configured independently
Closes gh-6057
parent
5840a691
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
0 deletions
+42
-0
EndpointWebMvcChildContextConfiguration.java
...utoconfigure/EndpointWebMvcChildContextConfiguration.java
+3
-0
ManagementServerProperties.java
...oot/actuate/autoconfigure/ManagementServerProperties.java
+13
-0
EndpointWebMvcAutoConfigurationTests.java
...e/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
+26
-0
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java
View file @
3546ae39
...
...
@@ -188,6 +188,9 @@ public class EndpointWebMvcChildContextConfiguration {
container
.
setContextPath
(
""
);
// and add the management-specific bits
container
.
setPort
(
this
.
managementServerProperties
.
getPort
());
if
(
this
.
managementServerProperties
.
getSsl
()
!=
null
)
{
container
.
setSsl
(
this
.
managementServerProperties
.
getSsl
());
}
container
.
setServerHeader
(
this
.
server
.
getServerHeader
());
container
.
setAddress
(
this
.
managementServerProperties
.
getAddress
());
container
.
addErrorPages
(
new
ErrorPage
(
this
.
server
.
getError
().
getPath
()));
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java
View file @
3546ae39
...
...
@@ -25,7 +25,9 @@ import javax.validation.constraints.NotNull;
import
org.springframework.boot.autoconfigure.security.SecurityPrerequisite
;
import
org.springframework.boot.autoconfigure.security.SecurityProperties
;
import
org.springframework.boot.autoconfigure.web.ServerProperties
;
import
org.springframework.boot.context.embedded.Ssl
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.NestedConfigurationProperty
;
import
org.springframework.security.config.http.SessionCreationPolicy
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.StringUtils
;
...
...
@@ -68,6 +70,9 @@ public class ManagementServerProperties implements SecurityPrerequisite {
*/
private
Integer
port
;
@NestedConfigurationProperty
private
Ssl
ssl
;
/**
* Network address that the management endpoints should bind to.
*/
...
...
@@ -112,6 +117,14 @@ public class ManagementServerProperties implements SecurityPrerequisite {
this
.
port
=
port
;
}
public
Ssl
getSsl
()
{
return
this
.
ssl
;
}
public
void
setSsl
(
Ssl
ssl
)
{
this
.
ssl
=
ssl
;
}
public
InetAddress
getAddress
()
{
return
this
.
address
;
}
...
...
spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java
View file @
3546ae39
...
...
@@ -175,6 +175,32 @@ public class EndpointWebMvcAutoConfigurationTests {
assertThat
(
interceptors
).
hasSize
(
1
);
}
@Test
public
void
onDifferentPortManagementSslDisabled
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
applicationContext
,
"management.ssl.enabled:false"
);
this
.
applicationContext
.
register
(
RootConfig
.
class
,
EndpointConfig
.
class
,
DifferentPortConfig
.
class
,
BaseConfiguration
.
class
,
EndpointWebMvcAutoConfiguration
.
class
,
ErrorMvcAutoConfiguration
.
class
);
this
.
applicationContext
.
refresh
();
assertContent
(
"/controller"
,
ports
.
get
().
server
,
"controlleroutput"
);
assertContent
(
"/endpoint"
,
ports
.
get
().
server
,
null
);
assertContent
(
"/controller"
,
ports
.
get
().
management
,
null
);
assertContent
(
"/endpoint"
,
ports
.
get
().
management
,
"endpointoutput"
);
assertContent
(
"/error"
,
ports
.
get
().
management
,
startsWith
(
"{"
));
ApplicationContext
managementContext
=
this
.
applicationContext
.
getBean
(
ManagementContextResolver
.
class
).
getApplicationContext
();
List
<?>
interceptors
=
(
List
<?>)
ReflectionTestUtils
.
getField
(
managementContext
.
getBean
(
EndpointHandlerMapping
.
class
),
"interceptors"
);
assertThat
(
interceptors
).
hasSize
(
1
);
ManagementServerProperties
managementServerProperties
=
this
.
applicationContext
.
getBean
(
ManagementServerProperties
.
class
);
assertThat
(
managementServerProperties
.
getSsl
()).
isNotNull
();
assertThat
(
managementServerProperties
.
getSsl
().
isEnabled
()).
isFalse
();
this
.
applicationContext
.
close
();
assertAllClosed
();
}
@Test
public
void
onDifferentPortWithSpecificContainer
()
throws
Exception
{
this
.
applicationContext
.
register
(
SpecificContainerConfig
.
class
,
RootConfig
.
class
,
...
...
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