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
3bec55e1
Commit
3bec55e1
authored
Feb 13, 2018
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting
parent
3880bdb9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
51 deletions
+53
-51
CloudFoundryReactiveHealthEndpointWebExtensionTests.java
.../CloudFoundryReactiveHealthEndpointWebExtensionTests.java
+18
-18
CloudFoundryHealthEndpointWebExtensionTests.java
.../servlet/CloudFoundryHealthEndpointWebExtensionTests.java
+17
-20
HealthEndpointWebExtension.java
...ework/boot/actuate/health/HealthEndpointWebExtension.java
+1
-2
spring-boot-features.adoc
...ing-boot-docs/src/main/asciidoc/spring-boot-features.adoc
+13
-10
CustomWebFluxSecurityExample.java
.../boot/docs/web/security/CustomWebFluxSecurityExample.java
+4
-1
No files found.
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/CloudFoundryReactiveHealthEndpointWebExtensionTests.java
View file @
3bec55e1
...
@@ -44,27 +44,27 @@ public class CloudFoundryReactiveHealthEndpointWebExtensionTests {
...
@@ -44,27 +44,27 @@ public class CloudFoundryReactiveHealthEndpointWebExtensionTests {
private
ReactiveWebApplicationContextRunner
contextRunner
=
new
ReactiveWebApplicationContextRunner
()
private
ReactiveWebApplicationContextRunner
contextRunner
=
new
ReactiveWebApplicationContextRunner
()
.
withPropertyValues
(
"VCAP_APPLICATION={}"
)
.
withPropertyValues
(
"VCAP_APPLICATION={}"
)
.
withConfiguration
(
.
withConfiguration
(
AutoConfigurations
.
of
(
AutoConfigurations
.
of
(
ReactiveSecurityAutoConfiguration
.
class
,
ReactiveSecurityAutoConfiguration
.
class
,
ReactiveUserDetailsServiceAutoConfiguration
.
class
,
ReactiveUserDetailsServiceAutoConfiguration
.
class
,
WebFluxAutoConfiguration
.
class
,
JacksonAutoConfiguration
.
class
,
WebFluxAutoConfiguration
.
class
,
JacksonAutoConfiguration
.
class
,
HttpMessageConvertersAutoConfiguration
.
class
,
HttpMessageConvertersAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
ReactiveCloudFoundryActuatorAutoConfigurationTests
.
WebClientCustomizerConfig
.
class
,
ReactiveCloudFoundryActuatorAutoConfigurationTests
.
WebClientCustomizerConfig
.
class
,
WebClientAutoConfiguration
.
class
,
ManagementContextAutoConfiguration
.
class
,
WebClientAutoConfiguration
.
class
,
EndpointAutoConfiguration
.
class
,
WebEndpointAutoConfiguration
.
class
,
ManagementContextAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
,
HealthEndpointAutoConfiguration
.
class
,
EndpointAutoConfiguration
.
class
,
WebEndpointAutoConfiguration
.
class
,
ReactiveCloudFoundryActuatorAutoConfiguration
.
class
));
HealthIndicatorAutoConfiguration
.
class
,
HealthEndpointAutoConfiguration
.
class
,
ReactiveCloudFoundryActuatorAutoConfiguration
.
class
));
@Test
@Test
public
void
healthDetailsAlwaysPresent
()
{
public
void
healthDetailsAlwaysPresent
()
{
this
.
contextRunner
this
.
contextRunner
.
run
((
context
)
->
{
.
run
((
context
)
->
{
CloudFoundryReactiveHealthEndpointWebExtension
extension
=
context
CloudFoundryReactiveHealthEndpointWebExtension
extension
=
context
.
getBean
(
CloudFoundryReactiveHealthEndpointWebExtension
.
class
);
.
getBean
(
CloudFoundryReactiveHealthEndpointWebExtension
.
class
);
assertThat
(
extension
.
health
().
block
().
getBody
().
getDetails
()).
isNotEmpty
();
assertThat
(
extension
.
health
().
block
().
getBody
().
getDetails
())
});
.
isNotEmpty
();
});
}
}
}
}
spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryHealthEndpointWebExtensionTests.java
View file @
3bec55e1
...
@@ -45,29 +45,26 @@ public class CloudFoundryHealthEndpointWebExtensionTests {
...
@@ -45,29 +45,26 @@ public class CloudFoundryHealthEndpointWebExtensionTests {
private
WebApplicationContextRunner
contextRunner
=
new
WebApplicationContextRunner
()
private
WebApplicationContextRunner
contextRunner
=
new
WebApplicationContextRunner
()
.
withPropertyValues
(
"VCAP_APPLICATION={}"
)
.
withPropertyValues
(
"VCAP_APPLICATION={}"
)
.
withConfiguration
(
.
withConfiguration
(
AutoConfigurations
.
of
(
SecurityAutoConfiguration
.
class
,
AutoConfigurations
.
of
(
SecurityAutoConfiguration
.
class
,
WebMvcAutoConfiguration
.
class
,
JacksonAutoConfiguration
.
class
,
WebMvcAutoConfiguration
.
class
,
JacksonAutoConfiguration
.
class
,
DispatcherServletAutoConfiguration
.
class
,
DispatcherServletAutoConfiguration
.
class
,
HttpMessageConvertersAutoConfiguration
.
class
,
HttpMessageConvertersAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
PropertyPlaceholderAutoConfiguration
.
class
,
RestTemplateAutoConfiguration
.
class
,
RestTemplateAutoConfiguration
.
class
,
ManagementContextAutoConfiguration
.
class
,
ManagementContextAutoConfiguration
.
class
,
ServletManagementContextAutoConfiguration
.
class
,
ServletManagementContextAutoConfiguration
.
class
,
EndpointAutoConfiguration
.
class
,
WebEndpointAutoConfiguration
.
class
,
EndpointAutoConfiguration
.
class
,
WebEndpointAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
,
HealthIndicatorAutoConfiguration
.
class
,
HealthEndpointAutoConfiguration
.
class
,
HealthEndpointAutoConfiguration
.
class
,
CloudFoundryActuatorAutoConfiguration
.
class
));
CloudFoundryActuatorAutoConfiguration
.
class
));
@Test
@Test
public
void
healthDetailsAlwaysPresent
()
{
public
void
healthDetailsAlwaysPresent
()
{
this
.
contextRunner
this
.
contextRunner
.
run
((
context
)
->
{
.
run
((
context
)
->
{
CloudFoundryHealthEndpointWebExtension
extension
=
context
CloudFoundryHealthEndpointWebExtension
extension
=
context
.
getBean
(
CloudFoundryHealthEndpointWebExtension
.
class
);
.
getBean
(
CloudFoundryHealthEndpointWebExtension
.
class
);
assertThat
(
extension
.
getHealth
().
getBody
().
getDetails
()).
isNotEmpty
();
assertThat
(
extension
.
getHealth
().
getBody
()
});
.
getDetails
()).
isNotEmpty
();
});
}
}
}
}
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthEndpointWebExtension.java
View file @
3bec55e1
...
@@ -60,8 +60,7 @@ public class HealthEndpointWebExtension {
...
@@ -60,8 +60,7 @@ public class HealthEndpointWebExtension {
Health
health
=
this
.
delegate
.
health
();
Health
health
=
this
.
delegate
.
health
();
Integer
status
=
this
.
statusHttpMapper
.
mapStatus
(
health
.
getStatus
());
Integer
status
=
this
.
statusHttpMapper
.
mapStatus
(
health
.
getStatus
());
if
(
showDetails
==
ShowDetails
.
NEVER
if
(
showDetails
==
ShowDetails
.
NEVER
||
(
showDetails
==
ShowDetails
.
WHEN_AUTHENTICATED
||
(
showDetails
==
ShowDetails
.
WHEN_AUTHENTICATED
&&
principal
==
null
))
{
&&
principal
==
null
))
{
health
=
Health
.
status
(
health
.
getStatus
()).
build
();
health
=
Health
.
status
(
health
.
getStatus
()).
build
();
}
}
return
new
WebEndpointResponse
<>(
health
,
status
);
return
new
WebEndpointResponse
<>(
health
,
status
);
...
...
spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc
View file @
3bec55e1
...
@@ -3023,21 +3023,23 @@ commonly used locations.
...
@@ -3023,21 +3023,23 @@ commonly used locations.
[[boot-features-security-webflux]]
[[boot-features-security-webflux]]
=== WebFlux Security
=== WebFlux Security
Similar to Spring MVC applications, you can secure your WebFlux applications by adding the `spring-boot-starter-security` dependency.
Similar to Spring MVC applications, you can secure your WebFlux applications by adding
The default security configuration is implemented in `ReactiveSecurityAutoConfiguration` and in
the `spring-boot-starter-security` dependency. The default security configuration is
the classes imported from there (`WebFluxSecurityConfiguration` for web security
implemented in `ReactiveSecurityAutoConfiguration` and in the classes imported from there
and `ReactiveAuthenticationManagerConfiguration` for authentication configuration, which is also
(`WebFluxSecurityConfiguration` for web security and
relevant in non-web applications). To switch off the default web application security
`ReactiveAuthenticationManagerConfiguration` for authentication configuration, which is
configuration completely, you can add a bean of type `WebFilterChainProxy` (doing
also relevant in non-web applications). To switch off the default web application security
so does not disable the authentication manager configuration or Actuator's security).
configuration completely, you can add a bean of type `WebFilterChainProxy` (doing so does
not disable the authentication manager configuration or Actuator's security).
To also switch off the authentication manager configuration, you can add a bean of type
To also switch off the authentication manager configuration, you can add a bean of type
`ReactiveUserDetailsService` or `ReactiveAuthenticationManager`.
`ReactiveUserDetailsService` or `ReactiveAuthenticationManager`.
Access rules can be configured by adding a custom `SecurityWebFilterChain`. Spring
Access rules can be configured by adding a custom `SecurityWebFilterChain`. Spring
Boot provides convenience methods that can be used to override access rules for actuator
Boot provides convenience methods that can be used to override access rules for actuator
endpoints and static resources. `EndpointRequest` can be used to create a `ServerWebExchangeMatcher`
endpoints and static resources. `EndpointRequest` can be used to create a
that is based on the `management.endpoints.web.base-path` property.
`ServerWebExchangeMatcher` that is based on the `management.endpoints.web.base-path`
property.
`PathRequest` can be used to create a `ServerWebExchangeMatcher` for resources in
`PathRequest` can be used to create a `ServerWebExchangeMatcher` for resources in
commonly used locations.
commonly used locations.
...
@@ -3046,10 +3048,11 @@ For example, you can customize your security configuration by adding something l
...
@@ -3046,10 +3048,11 @@ For example, you can customize your security configuration by adding something l
[source,java,indent=0]
[source,java,indent=0]
----
----
include::{code-examples}/web/security/CustomWebFluxSecurityExample.java[tag=c
ustom-webflux-security
]
include::{code-examples}/web/security/CustomWebFluxSecurityExample.java[tag=c
onfiguration
]
----
----
[[boot-features-security-oauth2]]
[[boot-features-security-oauth2]]
=== OAuth2
=== OAuth2
https://oauth.net/2/[OAuth2] is a widely used authorization framework that is supported by
https://oauth.net/2/[OAuth2] is a widely used authorization framework that is supported by
...
...
spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/web/security/CustomWebFluxSecurityExample.java
View file @
3bec55e1
...
@@ -30,6 +30,8 @@ import org.springframework.security.web.server.SecurityWebFilterChain;
...
@@ -30,6 +30,8 @@ import org.springframework.security.web.server.SecurityWebFilterChain;
@EnableWebFluxSecurity
@EnableWebFluxSecurity
public
class
CustomWebFluxSecurityExample
{
public
class
CustomWebFluxSecurityExample
{
// @formatter:off
// tag::configuration[]
@Bean
@Bean
public
SecurityWebFilterChain
springSecurityFilterChain
(
ServerHttpSecurity
http
)
{
public
SecurityWebFilterChain
springSecurityFilterChain
(
ServerHttpSecurity
http
)
{
http
http
...
@@ -40,6 +42,7 @@ public class CustomWebFluxSecurityExample {
...
@@ -40,6 +42,7 @@ public class CustomWebFluxSecurityExample {
.
formLogin
();
.
formLogin
();
return
http
.
build
();
return
http
.
build
();
}
}
// end::configuration[]
// @formatter:on
}
}
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