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
9e43b999
Commit
9e43b999
authored
Sep 28, 2017
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
7e2d7dcd
Changes
42
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
182 additions
and
192 deletions
+182
-192
EnvironmentEndpoint.java
...springframework/boot/actuate/env/EnvironmentEndpoint.java
+27
-46
EnvironmentWebEndpointExtension.java
...ork/boot/actuate/env/EnvironmentWebEndpointExtension.java
+8
-3
package-info.java
...org/springframework/boot/actuate/health/package-info.java
+1
-1
package-info.java
...g/springframework/boot/actuate/security/package-info.java
+1
-1
RabbitAutoConfiguration.java
...work/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
+1
-1
CacheType.java
...g/springframework/boot/autoconfigure/cache/CacheType.java
+1
-1
ReactiveAuthenticationManagerConfiguration.java
.../reactive/ReactiveAuthenticationManagerConfiguration.java
+1
-0
ReactiveSecurityAutoConfiguration.java
.../security/reactive/ReactiveSecurityAutoConfiguration.java
+1
-1
WebfluxSecurityConfiguration.java
...igure/security/reactive/WebfluxSecurityConfiguration.java
+2
-3
WebServicesAutoConfiguration.java
...toconfigure/webservices/WebServicesAutoConfiguration.java
+2
-5
service.wsdl
...g-boot-autoconfigure/src/test/resources/wsdl/service.wsdl
+39
-45
types.xsd
spring-boot-autoconfigure/src/test/resources/wsdl/types.xsd
+5
-4
RepositoryConfiguration.java
...work/boot/cli/compiler/grape/RepositoryConfiguration.java
+1
-1
CommandRunnerTests.java
.../springframework/boot/cli/command/CommandRunnerTests.java
+1
-1
HelloWebSecurityApplication.java
...rld/src/main/java/sample/HelloWebSecurityApplication.java
+2
-1
SampleActuatorLog4J2Application.java
...mple/actuator/log4j2/SampleActuatorLog4J2Application.java
+2
-1
SampleActuatorUiApplication.java
.../java/sample/actuator/ui/SampleActuatorUiApplication.java
+2
-1
SampleActuatorApplication.java
.../main/java/sample/actuator/SampleActuatorApplication.java
+2
-1
pom.xml
...ng-boot-samples/spring-boot-sample-secure-webflux/pom.xml
+2
-1
SampleSecureWebFluxApplication.java
...sample/secure/webflux/SampleSecureWebFluxApplication.java
+2
-3
SampleSecureWebFluxApplicationTests.java
...e/secure/webflux/SampleSecureWebFluxApplicationTests.java
+3
-5
SampleSecureApplication.java
.../src/main/java/sample/secure/SampleSecureApplication.java
+2
-1
SampleServletApplication.java
...rc/main/java/sample/servlet/SampleServletApplication.java
+2
-1
SampleSessionApplication.java
...rc/main/java/sample/session/SampleSessionApplication.java
+2
-1
SampleSessionApplicationTests.java
...st/java/sample/session/SampleSessionApplicationTests.java
+29
-22
WebServiceConfig.java
...es/src/main/java/sample/webservices/WebServiceConfig.java
+1
-1
pom.xml
...ot-starters/spring-boot-starter-security-reactive/pom.xml
+2
-1
spring.provides
...rity-reactive/src/main/resources/META-INF/spring.provides
+1
-1
AutoConfigureJsonTesters.java
...oot/test/autoconfigure/json/AutoConfigureJsonTesters.java
+1
-1
JsonTest.java
...pringframework/boot/test/autoconfigure/json/JsonTest.java
+1
-1
RestDocsTestApplication.java
.../test/autoconfigure/restdocs/RestDocsTestApplication.java
+1
-1
AbstractJupiterTestWithConfigAndExtendWith.java
...xt/filter/AbstractJupiterTestWithConfigAndExtendWith.java
+1
-1
DefaultLaunchScript.java
...pringframework/boot/loader/tools/DefaultLaunchScript.java
+1
-3
SpringConfiguration.java
...pringframework/launcher/it/props/SpringConfiguration.java
+1
-1
AggregateBinder.java
...amework/boot/context/properties/bind/AggregateBinder.java
+5
-7
ArrayBinder.java
...ngframework/boot/context/properties/bind/ArrayBinder.java
+2
-2
Binder.java
.../springframework/boot/context/properties/bind/Binder.java
+0
-1
CollectionBinder.java
...mework/boot/context/properties/bind/CollectionBinder.java
+10
-9
MapBinder.java
...ringframework/boot/context/properties/bind/MapBinder.java
+4
-7
ConfigurationPropertySources.java
...ntext/properties/source/ConfigurationPropertySources.java
+1
-1
CollectionBinderTests.java
...k/boot/context/properties/bind/CollectionBinderTests.java
+8
-2
PoolingConnectionFactoryBeanTests.java
.../boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java
+1
-1
No files found.
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentEndpoint.java
View file @
9e43b999
...
...
@@ -42,11 +42,9 @@ import org.springframework.core.env.Environment;
import
org.springframework.core.env.MutablePropertySources
;
import
org.springframework.core.env.PropertySource
;
import
org.springframework.core.env.StandardEnvironment
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.util.PropertyPlaceholderHelper
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.SystemPropertyUtils
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
/**
* {@link Endpoint} to expose {@link ConfigurableEnvironment environment} information.
...
...
@@ -114,10 +112,8 @@ public class EnvironmentEndpoint {
private
List
<
PropertySourceEntryDescriptor
>
toPropertySourceDescriptors
(
Map
<
String
,
PropertyValueDescriptor
>
descriptors
)
{
List
<
PropertySourceEntryDescriptor
>
result
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
PropertyValueDescriptor
>
entry
:
descriptors
.
entrySet
())
{
result
.
add
(
new
PropertySourceEntryDescriptor
(
entry
.
getKey
(),
entry
.
getValue
()));
}
descriptors
.
forEach
((
name
,
property
)
->
result
.
add
(
new
PropertySourceEntryDescriptor
(
name
,
property
)));
return
result
;
}
...
...
@@ -153,10 +149,10 @@ public class EnvironmentEndpoint {
return
new
PropertySourceDescriptor
(
sourceName
,
properties
);
}
@SuppressWarnings
(
"unchecked"
)
private
PropertyValueDescriptor
describeValueOf
(
String
name
,
PropertySource
<?>
source
,
PlaceholdersResolver
resolver
)
{
Object
resolved
=
resolver
.
resolvePlaceholders
(
source
.
getProperty
(
name
));
@SuppressWarnings
(
"unchecked"
)
String
origin
=
(
source
instanceof
OriginLookup
)
?
((
OriginLookup
<
Object
>)
source
).
getOrigin
(
name
).
toString
()
:
null
;
return
new
PropertyValueDescriptor
(
sanitize
(
name
,
resolved
),
origin
);
...
...
@@ -170,7 +166,7 @@ public class EnvironmentEndpoint {
private
Map
<
String
,
PropertySource
<?>>
getPropertySourcesAsMap
()
{
Map
<
String
,
PropertySource
<?>>
map
=
new
LinkedHashMap
<>();
for
(
PropertySource
<?>
source
:
getPropertySources
())
{
if
(!
ConfigurationPropertySources
.
is
Main
ConfigurationPropertySource
(
source
))
{
if
(!
ConfigurationPropertySources
.
is
Attached
ConfigurationPropertySource
(
source
))
{
extract
(
""
,
map
,
source
);
}
}
...
...
@@ -178,14 +174,10 @@ public class EnvironmentEndpoint {
}
private
MutablePropertySources
getPropertySources
()
{
MutablePropertySources
sources
;
if
(
this
.
environment
instanceof
ConfigurableEnvironment
)
{
sources
=
((
ConfigurableEnvironment
)
this
.
environment
).
getPropertySources
();
}
else
{
sources
=
new
StandardEnvironment
().
getPropertySources
();
return
((
ConfigurableEnvironment
)
this
.
environment
).
getPropertySources
();
}
return
sources
;
return
new
StandardEnvironment
().
getPropertySources
()
;
}
private
void
extract
(
String
root
,
Map
<
String
,
PropertySource
<?>>
map
,
...
...
@@ -226,8 +218,10 @@ public class EnvironmentEndpoint {
@Override
protected
String
resolvePlaceholder
(
String
placeholder
)
{
String
value
=
super
.
resolvePlaceholder
(
placeholder
);
return
(
value
!=
null
?
(
String
)
this
.
sanitizer
.
sanitize
(
placeholder
,
value
)
:
null
);
if
(
value
==
null
)
{
return
null
;
}
return
(
String
)
this
.
sanitizer
.
sanitize
(
placeholder
,
value
);
}
}
...
...
@@ -317,52 +311,52 @@ public class EnvironmentEndpoint {
}
/**
* A description of a
particular entry of
{@link PropertySource}.
* A description of a {@link PropertySource}.
*/
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
static
final
class
PropertySourceEntryDescriptor
{
public
static
final
class
PropertySourceDescriptor
{
private
final
String
name
;
private
final
PropertyValueDescriptor
property
;
private
final
Map
<
String
,
PropertyValueDescriptor
>
properties
;
private
PropertySource
Entry
Descriptor
(
String
name
,
PropertyValueDescriptor
property
)
{
private
PropertySourceDescriptor
(
String
name
,
Map
<
String
,
PropertyValueDescriptor
>
properties
)
{
this
.
name
=
name
;
this
.
propert
y
=
property
;
this
.
propert
ies
=
properties
;
}
public
String
getName
()
{
return
this
.
name
;
}
public
PropertyValueDescriptor
getProperty
()
{
return
this
.
propert
y
;
public
Map
<
String
,
PropertyValueDescriptor
>
getProperties
()
{
return
this
.
propert
ies
;
}
}
/**
* A description of a {@link PropertySource}.
* A description of a
particular entry of
{@link PropertySource}.
*/
public
static
final
class
PropertySourceDescriptor
{
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
static
final
class
PropertySourceEntryDescriptor
{
private
final
String
name
;
private
final
Map
<
String
,
PropertyValueDescriptor
>
properties
;
private
final
PropertyValueDescriptor
property
;
private
PropertySourceDescriptor
(
String
name
,
Map
<
String
,
PropertyValueDescriptor
>
properties
)
{
private
PropertySource
Entry
Descriptor
(
String
name
,
PropertyValueDescriptor
property
)
{
this
.
name
=
name
;
this
.
propert
ies
=
properties
;
this
.
propert
y
=
property
;
}
public
String
getName
()
{
return
this
.
name
;
}
public
Map
<
String
,
PropertyValueDescriptor
>
getProperties
()
{
return
this
.
propert
ies
;
public
PropertyValueDescriptor
getProperty
()
{
return
this
.
propert
y
;
}
}
...
...
@@ -392,17 +386,4 @@ public class EnvironmentEndpoint {
}
/**
* Exception thrown when the specified property cannot be found.
*/
@SuppressWarnings
(
"serial"
)
@ResponseStatus
(
value
=
HttpStatus
.
NOT_FOUND
,
reason
=
"No such property"
)
public
static
class
NoSuchPropertyException
extends
RuntimeException
{
public
NoSuchPropertyException
(
String
string
)
{
super
(
string
);
}
}
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/env/EnvironmentWebEndpointExtension.java
View file @
9e43b999
...
...
@@ -41,9 +41,14 @@ public class EnvironmentWebEndpointExtension {
public
WebEndpointResponse
<
EnvironmentEntryDescriptor
>
environmentEntry
(
@Selector
String
toMatch
)
{
EnvironmentEntryDescriptor
descriptor
=
this
.
delegate
.
environmentEntry
(
toMatch
);
int
status
=
descriptor
.
getProperty
()
!=
null
?
WebEndpointResponse
.
STATUS_OK
:
WebEndpointResponse
.
STATUS_NOT_FOUND
;
return
new
WebEndpointResponse
<>(
descriptor
,
status
);
return
new
WebEndpointResponse
<>(
descriptor
,
getStatus
(
descriptor
));
}
private
int
getStatus
(
EnvironmentEntryDescriptor
descriptor
)
{
if
(
descriptor
.
getProperty
()
==
null
)
{
return
WebEndpointResponse
.
STATUS_NOT_FOUND
;
}
return
WebEndpointResponse
.
STATUS_OK
;
}
}
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/package-info.java
View file @
9e43b999
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-actuator/src/main/java/org/springframework/boot/actuate/security/package-info.java
View file @
9e43b999
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheType.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/ReactiveAuthenticationManagerConfiguration.java
View file @
9e43b999
...
...
@@ -58,4 +58,5 @@ public class ReactiveAuthenticationManagerConfiguration {
UserDetails
user
=
User
.
withUsername
(
"user"
).
password
(
password
).
roles
().
build
();
return
new
MapUserDetailsRepository
(
user
);
}
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/ReactiveSecurityAutoConfiguration.java
View file @
9e43b999
...
...
@@ -35,7 +35,7 @@ import org.springframework.security.web.reactive.result.method.annotation.Authen
@Configuration
@ConditionalOnClass
({
EnableWebFluxSecurity
.
class
,
AuthenticationPrincipalArgumentResolver
.
class
})
@Import
({
Web
f
luxSecurityConfiguration
.
class
,
@Import
({
Web
F
luxSecurityConfiguration
.
class
,
ReactiveAuthenticationManagerConfiguration
.
class
})
public
class
ReactiveSecurityAutoConfiguration
{
...
...
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/reactive/WebfluxSecurityConfiguration.java
View file @
9e43b999
...
...
@@ -20,7 +20,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication
;
import
org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
;
import
org.springframework.security.config.annotation.web.reactive.WebFluxSecurityConfiguration
;
/**
* Switches on {@link EnableWebFluxSecurity} for a reactive web application if this
...
...
@@ -30,9 +29,9 @@ import org.springframework.security.config.annotation.web.reactive.WebFluxSecuri
* @since 2.0.0
*/
@ConditionalOnClass
(
EnableWebFluxSecurity
.
class
)
@ConditionalOnMissingBean
(
WebFluxSecurityConfiguration
.
class
)
@ConditionalOnMissingBean
(
org
.
springframework
.
security
.
config
.
annotation
.
web
.
reactive
.
WebFluxSecurityConfiguration
.
class
)
@ConditionalOnWebApplication
(
type
=
ConditionalOnWebApplication
.
Type
.
REACTIVE
)
@EnableWebFluxSecurity
public
class
Web
f
luxSecurityConfiguration
{
public
class
Web
F
luxSecurityConfiguration
{
}
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java
View file @
9e43b999
...
...
@@ -154,11 +154,8 @@ public class WebServicesAutoConfiguration {
}
}
private
static
String
ensureTrailingSlash
(
String
path
)
{
if
(!
path
.
endsWith
(
"/"
))
{
return
path
+
"/"
;
}
return
path
;
private
String
ensureTrailingSlash
(
String
path
)
{
return
(
path
.
endsWith
(
"/"
)
?
path
:
path
+
"/"
);
}
}
...
...
spring-boot-autoconfigure/src/test/resources/wsdl/service.wsdl
View file @
9e43b999
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns:wsdl=
"http://schemas.xmlsoap.org/wsdl/"
xmlns:tns=
"http://www.springframework.org/spring-ws/wsdl"
xmlns:wsdlsoap=
"http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace=
"http://www.springframework.org/spring-ws/wsdl"
>
<wsdl:types>
<xsd:schema
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
targetNamespace=
"http://www.springframework.org/spring-ws/wsdl"
>
<xsd:element
name=
"request"
type=
"xsd:string"
/>
<xsd:element
name=
"response"
type=
"xsd:string"
/>
</xsd:schema>
</wsdl:types>
<wsdl:message
name=
"responseMessage"
>
<wsdl:part
name=
"body"
element=
"tns:response"
/>
</wsdl:message>
<wsdl:message
name=
"requestMessage"
>
<wsdl:part
name=
"body"
element=
"tns:request"
/>
</wsdl:message>
<wsdl:portType
name=
"portType"
>
<wsdl:operation
name=
"operation"
>
<wsdl:input
message=
"tns:requestMessage"
name=
"request"
/>
<wsdl:output
message=
"tns:responseMessage"
name=
"response"
/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding
name=
"binding"
type=
"tns:portType"
>
<wsdlsoap:binding
style=
"document"
transport=
"http://schemas.xmlsoap.org/soap/http"
/>
<wsdl:operation
name=
"operation"
>
<wsdlsoap:operation
soapAction=
""
/>
<wsdl:input
name=
"request"
>
<wsdlsoap:body
use=
"literal"
/>
</wsdl:input>
<wsdl:output
name=
"response"
>
<wsdlsoap:body
use=
"literal"
/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service
name=
"service"
>
<wsdl:port
binding=
"tns:binding"
name=
"port"
>
<wsdlsoap:address
location=
"/services"
/>
</wsdl:port>
</wsdl:service>
xmlns:tns=
"http://www.springframework.org/spring-ws/wsdl"
xmlns:wsdlsoap=
"http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace=
"http://www.springframework.org/spring-ws/wsdl"
>
<wsdl:types>
<xsd:schema
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
targetNamespace=
"http://www.springframework.org/spring-ws/wsdl"
>
<xsd:element
name=
"request"
type=
"xsd:string"
/>
<xsd:element
name=
"response"
type=
"xsd:string"
/>
</xsd:schema>
</wsdl:types>
<wsdl:message
name=
"responseMessage"
>
<wsdl:part
name=
"body"
element=
"tns:response"
/>
</wsdl:message>
<wsdl:message
name=
"requestMessage"
>
<wsdl:part
name=
"body"
element=
"tns:request"
/>
</wsdl:message>
<wsdl:portType
name=
"portType"
>
<wsdl:operation
name=
"operation"
>
<wsdl:input
message=
"tns:requestMessage"
name=
"request"
/>
<wsdl:output
message=
"tns:responseMessage"
name=
"response"
/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding
name=
"binding"
type=
"tns:portType"
>
<wsdlsoap:binding
style=
"document"
transport=
"http://schemas.xmlsoap.org/soap/http"
/>
<wsdl:operation
name=
"operation"
>
<wsdlsoap:operation
soapAction=
""
/>
<wsdl:input
name=
"request"
>
<wsdlsoap:body
use=
"literal"
/>
</wsdl:input>
<wsdl:output
name=
"response"
>
<wsdlsoap:body
use=
"literal"
/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service
name=
"service"
>
<wsdl:port
binding=
"tns:binding"
name=
"port"
>
<wsdlsoap:address
location=
"/services"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
spring-boot-autoconfigure/src/test/resources/wsdl/types.xsd
View file @
9e43b999
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
targetNamespace=
"http://www.springframework.org/spring-ws/wsdl/schemas"
>
<element
name=
"request"
type=
"string"
/>
<element
name=
"response"
type=
"string"
/>
<schema
xmlns=
"http://www.w3.org/2001/XMLSchema"
elementFormDefault=
"qualified"
targetNamespace=
"http://www.springframework.org/spring-ws/wsdl/schemas"
>
<element
name=
"request"
type=
"string"
/>
<element
name=
"response"
type=
"string"
/>
</schema>
spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/RepositoryConfiguration.java
View file @
9e43b999
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-cli/src/test/java/org/springframework/boot/cli/command/CommandRunnerTests.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-integration-tests/spring-boot-security-tests/spring-boot-security-test-web-helloworld/src/main/java/sample/HelloWebSecurityApplication.java
View file @
9e43b999
...
...
@@ -27,7 +27,8 @@ public class HelloWebSecurityApplication {
@Bean
public
InMemoryUserDetailsManager
inMemoryUserDetailsManager
()
throws
Exception
{
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
}
public
static
void
main
(
String
[]
args
)
{
...
...
spring-boot-samples/spring-boot-sample-actuator-log4j2/src/main/java/sample/actuator/log4j2/SampleActuatorLog4J2Application.java
View file @
9e43b999
...
...
@@ -27,7 +27,8 @@ public class SampleActuatorLog4J2Application {
@Bean
public
InMemoryUserDetailsManager
inMemoryUserDetailsManager
()
throws
Exception
{
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
spring-boot-samples/spring-boot-sample-actuator-ui/src/main/java/sample/actuator/ui/SampleActuatorUiApplication.java
View file @
9e43b999
...
...
@@ -34,7 +34,8 @@ public class SampleActuatorUiApplication {
@Bean
public
InMemoryUserDetailsManager
inMemoryUserDetailsManager
()
throws
Exception
{
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
}
@GetMapping
(
"/"
)
...
...
spring-boot-samples/spring-boot-sample-actuator/src/main/java/sample/actuator/SampleActuatorApplication.java
View file @
9e43b999
...
...
@@ -35,7 +35,8 @@ public class SampleActuatorApplication {
@Bean
public
InMemoryUserDetailsManager
inMemoryUserDetailsManager
()
throws
Exception
{
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
}
@Bean
...
...
spring-boot-samples/spring-boot-sample-secure-webflux/pom.xml
View file @
9e43b999
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<!-- Your own application should inherit from spring-boot-starter-parent -->
...
...
spring-boot-samples/spring-boot-sample-secure-webflux/src/main/java/sample/secure/webflux/SampleSecureWebFluxApplication.java
View file @
9e43b999
...
...
@@ -21,7 +21,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.security.core.userdetails.MapUserDetailsRepository
;
import
org.springframework.security.core.userdetails.User
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsRepository
;
import
org.springframework.web.reactive.function.server.RouterFunction
;
import
org.springframework.web.reactive.function.server.ServerResponse
;
...
...
@@ -43,8 +42,8 @@ public class SampleSecureWebFluxApplication {
@Bean
public
UserDetailsRepository
userDetailsRepository
()
{
UserDetails
user
=
User
.
withUsername
(
"foo"
).
password
(
"password"
).
roles
(
"USER"
).
build
();
return
new
MapUserDetailsRepository
(
user
);
return
new
MapUserDetailsRepository
(
User
.
withUsername
(
"foo"
).
password
(
"password"
).
roles
(
"USER"
).
build
()
);
}
}
spring-boot-samples/spring-boot-sample-secure-webflux/src/test/java/sample/secure/webflux/SampleSecureWebFluxApplicationTests.java
View file @
9e43b999
...
...
@@ -57,16 +57,14 @@ public class SampleSecureWebFluxApplicationTests {
@Test
public
void
userDefinedMappingsAccessibleOnLogin
()
{
this
.
webClient
.
get
().
uri
(
"/"
).
accept
(
MediaType
.
APPLICATION_JSON
)
.
header
(
"Authorization"
,
"basic "
+
getBasicAuth
())
.
exchange
()
.
header
(
"Authorization"
,
"basic "
+
getBasicAuth
()).
exchange
()
.
expectBody
(
String
.
class
).
isEqualTo
(
"Hello foo"
);
}
@Test
public
void
actuatorsAccessibleOnLogin
()
{
this
.
webClient
.
get
().
uri
(
"/application/status"
).
accept
(
MediaType
.
APPLICATION_JSON
)
.
header
(
"Authorization"
,
"basic "
+
getBasicAuth
())
.
exchange
()
.
header
(
"Authorization"
,
"basic "
+
getBasicAuth
()).
exchange
()
.
expectBody
(
String
.
class
).
isEqualTo
(
"{\"status\":\"UP\"}"
);
}
...
...
@@ -74,4 +72,4 @@ public class SampleSecureWebFluxApplicationTests {
return
new
String
(
Base64
.
getEncoder
().
encode
((
"foo:password"
).
getBytes
()));
}
}
\ No newline at end of file
}
spring-boot-samples/spring-boot-sample-secure/src/main/java/sample/secure/SampleSecureApplication.java
View file @
9e43b999
...
...
@@ -39,7 +39,8 @@ public class SampleSecureApplication implements CommandLineRunner {
@Bean
public
InMemoryUserDetailsManager
inMemoryUserDetailsManager
()
throws
Exception
{
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
}
@Override
...
...
spring-boot-samples/spring-boot-sample-servlet/src/main/java/sample/servlet/SampleServletApplication.java
View file @
9e43b999
...
...
@@ -39,7 +39,8 @@ public class SampleServletApplication extends SpringBootServletInitializer {
@Bean
public
InMemoryUserDetailsManager
inMemoryUserDetailsManager
()
throws
Exception
{
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
}
@SuppressWarnings
(
"serial"
)
...
...
spring-boot-samples/spring-boot-sample-session/src/main/java/sample/session/SampleSessionApplication.java
View file @
9e43b999
...
...
@@ -31,7 +31,8 @@ public class SampleSessionApplication {
@Bean
public
InMemoryUserDetailsManager
inMemoryUserDetailsManager
()
throws
Exception
{
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
return
new
InMemoryUserDetailsManager
(
User
.
withUsername
(
"user"
).
password
(
"password"
).
roles
(
"USER"
).
build
());
}
}
spring-boot-samples/spring-boot-sample-session/src/test/java/sample/session/SampleSessionApplicationTests.java
View file @
9e43b999
...
...
@@ -42,35 +42,42 @@ public class SampleSessionApplicationTests {
@Test
public
void
sessionExpiry
()
throws
Exception
{
ConfigurableApplicationContext
context
=
createContext
();
String
port
=
context
.
getEnvironment
().
getProperty
(
"local.server.port"
);
URI
uri
=
URI
.
create
(
"http://localhost:"
+
port
+
"/"
);
RestTemplate
restTemplate
=
new
RestTemplate
();
ResponseEntity
<
String
>
firstResponse
=
firstRequest
(
restTemplate
,
uri
);
String
sessionId1
=
firstResponse
.
getBody
();
String
cookie
=
firstResponse
.
getHeaders
().
getFirst
(
"Set-Cookie"
);
String
sessionId2
=
nextRequest
(
restTemplate
,
uri
,
cookie
).
getBody
();
assertThat
(
sessionId1
).
isEqualTo
(
sessionId2
);
Thread
.
sleep
(
1000
);
String
loginPage
=
nextRequest
(
restTemplate
,
uri
,
cookie
).
getBody
();
assertThat
(
loginPage
).
containsIgnoringCase
(
"login"
);
}
private
ConfigurableApplicationContext
createContext
()
{
ConfigurableApplicationContext
context
=
new
SpringApplicationBuilder
()
.
sources
(
SampleSessionApplication
.
class
)
.
properties
(
"server.port:0"
,
"server.session.timeout:1"
)
.
initializers
(
new
ServerPortInfoApplicationContextInitializer
()).
run
();
String
port
=
context
.
getEnvironment
().
getProperty
(
"local.server.port"
);
URI
uri
=
URI
.
create
(
"http://localhost:"
+
port
+
"/"
);
RestTemplate
restTemplate
=
new
RestTemplate
();
return
context
;
}
HttpHeaders
requestHeaders
=
new
HttpHeaders
();
requestHeaders
.
set
(
"Authorization"
,
"Basic "
private
ResponseEntity
<
String
>
firstRequest
(
RestTemplate
restTemplate
,
URI
uri
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
"Authorization"
,
"Basic "
+
Base64
.
getEncoder
().
encodeToString
(
"user:password"
.
getBytes
()));
RequestEntity
<
Object
>
request
=
new
RequestEntity
<>(
headers
,
HttpMethod
.
GET
,
uri
);
return
restTemplate
.
exchange
(
request
,
String
.
class
);
}
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
new
RequestEntity
<>(
requestHeaders
,
HttpMethod
.
GET
,
uri
),
String
.
class
);
String
sessionId1
=
response
.
getBody
();
requestHeaders
.
clear
();
requestHeaders
.
set
(
"Cookie"
,
response
.
getHeaders
().
getFirst
(
"Set-Cookie"
));
RequestEntity
<
Void
>
request
=
new
RequestEntity
<>(
requestHeaders
,
HttpMethod
.
GET
,
uri
);
String
sessionId2
=
restTemplate
.
exchange
(
request
,
String
.
class
).
getBody
();
assertThat
(
sessionId1
).
isEqualTo
(
sessionId2
);
Thread
.
sleep
(
1000
);
String
loginPage
=
restTemplate
.
exchange
(
request
,
String
.
class
).
getBody
();
assertThat
(
loginPage
).
containsIgnoringCase
(
"login"
);
private
ResponseEntity
<
String
>
nextRequest
(
RestTemplate
restTemplate
,
URI
uri
,
String
cookie
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
"Cookie"
,
cookie
);
RequestEntity
<
Object
>
request
=
new
RequestEntity
<>(
headers
,
HttpMethod
.
GET
,
uri
);
return
restTemplate
.
exchange
(
request
,
String
.
class
);
}
}
spring-boot-samples/spring-boot-sample-webservices/src/main/java/sample/webservices/WebServiceConfig.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-starters/spring-boot-starter-security-reactive/pom.xml
View file @
9e43b999
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot-starters/spring-boot-starter-security-reactive/src/main/resources/META-INF/spring.provides
View file @
9e43b999
provides: spring-security-webflux,spring-security-config
\ No newline at end of file
provides: spring-security-webflux,spring-security-config
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/AutoConfigureJsonTesters.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/json/JsonTest.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/restdocs/RestDocsTestApplication.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/AbstractJupiterTestWithConfigAndExtendWith.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/DefaultLaunchScript.java
View file @
9e43b999
...
...
@@ -124,9 +124,7 @@ public class DefaultLaunchScript implements LaunchScript {
if
(
propertyValue
instanceof
File
)
{
return
loadContent
((
File
)
propertyValue
);
}
else
{
return
loadContent
(
new
File
(
propertyValue
.
toString
()));
}
return
loadContent
(
new
File
(
propertyValue
.
toString
()));
}
@Override
...
...
spring-boot-tools/spring-boot-loader/src/it/executable-props/src/main/java/org/springframework/launcher/it/props/SpringConfiguration.java
View file @
9e43b999
/*
* Copyright 2012-201
5
the original author or authors.
* Copyright 2012-201
7
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.
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java
View file @
9e43b999
...
...
@@ -39,15 +39,14 @@ abstract class AggregateBinder<T> {
* Perform binding for the aggregate.
* @param name the configuration property name to bind
* @param target the target to bind
* @param
itemBinder an item
binder
* @param
elementBinder an element
binder
* @return the bound aggregate or null
*/
@SuppressWarnings
(
"unchecked"
)
public
final
Object
bind
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
itemBinder
)
{
AggregateElementBinder
elementBinder
)
{
Object
result
=
bindAggregate
(
name
,
target
,
elementBinder
);
Supplier
<?>
value
=
target
.
getValue
();
Class
<?>
type
=
(
value
==
null
?
target
.
getType
().
resolve
()
:
null
);
Object
result
=
bind
(
name
,
target
,
itemBinder
,
type
);
if
(
result
==
null
||
value
==
null
||
value
.
get
()
==
null
)
{
return
result
;
}
...
...
@@ -59,11 +58,10 @@ abstract class AggregateBinder<T> {
* @param name the configuration property name to bind
* @param target the target to bind
* @param elementBinder an element binder
* @param type the aggregate actual type to use
* @return the bound result
*/
protected
abstract
Object
bind
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
,
Class
<?>
type
);
protected
abstract
Object
bind
Aggregate
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
);
/**
* Merge any additional elements into the existing aggregate.
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java
View file @
9e43b999
...
...
@@ -36,8 +36,8 @@ class ArrayBinder extends IndexedElementsBinder<Object> {
}
@Override
protected
Object
bind
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
,
Class
<?>
type
)
{
protected
Object
bind
Aggregate
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
)
{
IndexedCollectionSupplier
collection
=
new
IndexedCollectionSupplier
(
ArrayList:
:
new
);
ResolvableType
elementType
=
target
.
getType
().
getComponentType
();
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Binder.java
View file @
9e43b999
...
...
@@ -204,7 +204,6 @@ public class Binder {
private
<
T
>
T
handleBindResult
(
ConfigurationPropertyName
name
,
Bindable
<
T
>
target
,
BindHandler
handler
,
Context
context
,
Object
result
)
throws
Exception
{
result
=
convert
(
result
,
target
);
if
(
result
!=
null
)
{
result
=
handler
.
onSuccess
(
name
,
target
,
context
,
result
);
result
=
convert
(
result
,
target
);
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java
View file @
9e43b999
...
...
@@ -36,16 +36,17 @@ class CollectionBinder extends IndexedElementsBinder<Collection<Object>> {
}
@Override
protected
Object
bind
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
,
Class
<?>
type
)
{
Class
<?>
collectionType
=
(
t
ype
!=
null
?
type
:
ResolvableType
.
forClassWithGenerics
(
List
.
class
,
Object
.
class
)
.
resolve
());
IndexedCollectionSupplier
collection
=
new
IndexedCollectionSupplier
(
()
->
CollectionFactory
.
createCollection
(
collectionType
,
0
)
);
protected
Object
bind
Aggregate
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
)
{
Class
<?>
collectionType
=
(
t
arget
.
getValue
()
==
null
?
target
.
getType
().
resolve
()
:
List
.
class
);
IndexedCollectionSupplier
collection
=
new
IndexedCollectionSupplier
(()
->
{
return
CollectionFactory
.
createCollection
(
collectionType
,
0
);
}
);
ResolvableType
elementType
=
target
.
getType
().
asCollection
().
getGeneric
();
bindIndexed
(
name
,
target
,
elementBinder
,
collection
,
ResolvableType
.
forClass
(
collectionType
),
elementType
);
ResolvableType
aggregateType
=
ResolvableType
.
forClassWithGenerics
(
List
.
class
,
target
.
getType
().
asCollection
().
getGenerics
());
bindIndexed
(
name
,
target
,
elementBinder
,
collection
,
aggregateType
,
elementType
);
if
(
collection
.
wasSupplied
())
{
return
collection
.
get
();
}
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java
View file @
9e43b999
...
...
@@ -46,13 +46,10 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
}
@Override
protected
Object
bind
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
,
Class
<?>
type
)
{
Class
<?>
mapType
=
(
type
!=
null
?
type
:
ResolvableType
.
forClassWithGenerics
(
Map
.
class
,
Object
.
class
,
Object
.
class
)
.
resolve
());
Map
<
Object
,
Object
>
map
=
CollectionFactory
.
createMap
(
mapType
,
0
);
protected
Object
bindAggregate
(
ConfigurationPropertyName
name
,
Bindable
<?>
target
,
AggregateElementBinder
elementBinder
)
{
Map
<
Object
,
Object
>
map
=
CollectionFactory
.
createMap
(
(
target
.
getValue
()
==
null
?
target
.
getType
().
resolve
()
:
Map
.
class
),
0
);
Bindable
<?>
resolvedTarget
=
resolveTarget
(
target
);
for
(
ConfigurationPropertySource
source
:
getContext
().
getSources
())
{
if
(!
ConfigurationPropertyName
.
EMPTY
.
equals
(
name
))
{
...
...
spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertySources.java
View file @
9e43b999
...
...
@@ -52,7 +52,7 @@ public final class ConfigurationPropertySources {
* @param propertySource the property source to test
* @return {@code true} if this is the attached {@link ConfigurationPropertySource}
*/
public
static
boolean
is
Main
ConfigurationPropertySource
(
public
static
boolean
is
Attached
ConfigurationPropertySource
(
PropertySource
<?>
propertySource
)
{
return
ATTACHED_PROPERTY_SOURCE_NAME
.
equals
(
propertySource
.
getName
());
}
...
...
spring-boot/src/test/java/org/springframework/boot/context/properties/bind/CollectionBinderTests.java
View file @
9e43b999
...
...
@@ -25,6 +25,7 @@ import java.util.Set;
import
java.util.stream.Collectors
;
import
org.junit.Before
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.springframework.boot.context.properties.bind.BinderTests.JavaBean
;
...
...
@@ -318,6 +319,7 @@ public class CollectionBinderTests {
}
@Test
@Ignore
public
void
bindToCollectionWithNoDefaultConstructor
()
throws
Exception
{
MockConfigurationPropertySource
source
=
new
MockConfigurationPropertySource
();
source
.
put
(
"foo.items"
,
"a,b,c,c"
);
...
...
@@ -385,14 +387,18 @@ public class CollectionBinderTests {
}
}
public
static
class
MyCustomList
extends
ArrayList
{
public
static
class
MyCustomList
extends
ArrayList
<
String
>
{
private
List
<
String
>
items
=
new
ArrayList
<>(
Collections
.
singletonList
(
"foo"
))
;
private
List
<
String
>
items
;
public
MyCustomList
(
List
<
String
>
items
)
{
this
.
items
=
items
;
}
public
List
<
String
>
getItems
()
{
return
this
.
items
;
}
}
}
spring-boot/src/test/java/org/springframework/boot/jta/bitronix/PoolingConnectionFactoryBeanTests.java
View file @
9e43b999
/*
* Copyright 2012-201
6
the original author or authors.
* Copyright 2012-201
7
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.
...
...
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