Commit Graph

1536 Commits

Author SHA1 Message Date
Phillip Webb
fedd7b9506 Polish 2017-03-06 12:01:05 -08:00
Spring Buildmaster
d23fa24340 Next Development Version 2017-03-03 16:18:26 +00:00
Spring Buildmaster
2a83e80a9b Next Development Version 2017-03-03 14:39:21 +00:00
Madhura Bhave
d4b52a3538 Expose Health details if user has authority
If the Princial is a Spring Security Authentication object and the
request doesn't have the right roles, check the authorities.

Fixes gh-8471
2017-03-02 12:37:47 -08:00
Stephane Nicoll
5cc569fc91 Improve execution speed of CacheAutoConfigurationTests
As of Hazelcast 3.7, the bootstrap is pretty slow by default due to the
networking discovery. This commit disables both TCP/IP and multicast
discoveries.
2017-03-02 14:28:33 +01:00
Phillip Webb
3ee7dae09b Merge branch '1.4.x' into 1.5.x 2017-03-01 23:44:40 -08:00
Phillip Webb
f1012c104a Polish 2017-03-01 23:29:20 -08:00
Phillip Webb
c06a9771c2 Support list based role properties
Update `HealthMvcEndpoint` to respect `ManagementServerProperties`
roles. Prior to this commit the `HealthMvcEndpoint` directly loaded
roles rather than using bound properties. This meant that list values
from yaml were not respected.

Fixes gh-8314
2017-03-01 21:35:50 -08:00
Madhura Bhave
031c9bf191 Validate authorities in MvcSecurityInterceptor
If Spring Security is on the classpath and `isUserInRole` returns false,
check if user has the authority to access the actuator endpoints.

Fixes gh-8255
2017-03-01 17:55:30 -08:00
Madhura Bhave
e5e1f24d1f Revert "Skip MvcSecurityInterceptor if Spring Security present"
Instead of entirely skipping the interceptor, we will be additionally
checking for authorities.
2017-03-01 16:31:36 -08:00
Madhura Bhave
ad5cb8a3cd Skip MvcSecurityInterceptor if Spring Security present
If Spring Security is on the classpath, the role check can be done
as part of the ManagementWebSecurityConfigurerAdapter.

Fixes gh-8255
2017-03-01 14:44:06 -08:00
Phillip Webb
ca1540cefe Update header copyright for changed files 2017-02-27 20:41:18 -08:00
Phillip Webb
5867cd6175 Polish 2017-02-27 20:41:18 -08:00
Phillip Webb
47fd5f4fac Merge branch '1.4.x' into 1.5.x 2017-02-27 14:00:46 -08:00
Phillip Webb
47b00c086c Polish 2017-02-27 13:56:17 -08:00
Stephane Nicoll
121ab0a71e Merge branch '1.4.x' into 1.5.x 2017-02-17 10:32:49 +01:00
Vedran Pavic
1c8f1c709c Fix audit events related documentation
Closes gh-8319
2017-02-17 10:30:07 +01:00
Andy Wilkinson
e2a12e77b7 Merge branch '1.4.x' into 1.5.x 2017-02-14 11:23:25 +00:00
Andy Wilkinson
bbe9394228 Tests that lists of lists are sanitized correctly
See gh-8263
2017-02-14 11:22:04 +00:00
Johnny Lim
88afc43d44 Ensure that entries in a list of lists are not lost during sanitization
Closes gh-8263
See gh-8197
2017-02-14 11:20:14 +00:00
Madhura Bhave
77e5c585f4 Validate kid in Cloud Foundry token header
Instead of validating the signature against all the public keys,
we can validate it only against the public key with the kid that
matches the one in the token header.

Closes gh-8126
2017-02-09 16:47:44 -08:00
Andy Wilkinson
25982ecf69 Merge branch '1.4.x' into 1.5.x 2017-02-08 20:50:24 +00:00
Andy Wilkinson
04c8b912ee Fall back to standard LiveBeansView behaviour when MBean is in use
Closes gh-8146
2017-02-08 20:49:16 +00:00
Andy Wilkinson
d02a9c1058 Merge branch '1.4.x' into 1.5.x 2017-02-08 17:29:15 +00:00
Andy Wilkinson
f27bb39af9 Sanitize configuration properties that are nested beneath a List
Closes gh-8197
2017-02-08 17:21:41 +00:00
Johnny Lim
0adab8a2be Use logical 'and' instead of bitwise 'and'
Closes gh-8198
2017-02-06 10:35:13 +01:00
Stephane Nicoll
dc75f13754 Remove deprecated metadata for spring.pidfile 2017-02-05 09:26:32 +01:00
Stephane Nicoll
3d1f8aa8d7 Merge branch '1.4.x' into 1.5.x 2017-02-05 09:25:48 +01:00
Stephane Nicoll
a30461c5c7 Polish pid metadata
This commit moves the `spring.pid.*` metadata to the relevant project. It
also updates the doc to refer to the new `ApplicationPidFileWriter`
rather than the one in its deprecatred form.

Closes gh-8196
2017-02-05 09:23:56 +01:00
Phillip Webb
21234b36de Ensure JmxEndpoint beans get context object IDs
Update `EndpointMBeanExporter` to ensure that `JmxEndpoint` as well
as regular `Endpoint` beans are considered when searching the parent
context.

Prior to this commit if the same `JmxEndpoint` was registered in the
both the child and parent context then the `context=` element of the
name wasn't added.

Fixes gh-8152
2017-01-31 13:25:59 -08:00
Spring Buildmaster
5c12500366 Next Development Version 2017-01-30 20:10:13 +00:00
Spring Buildmaster
a2696bf873 Next Development Version 2017-01-30 11:40:24 +00:00
Andy Wilkinson
180ab2da8b Merge branch '1.4.x' into 1.5.x 2017-01-26 20:30:20 +00:00
Andy Wilkinson
f3b9b14b8e Order ManagementContextConfiguration classes without loading them
Previously, ManagementContextConfiguration classes were loaded to
allow them to be ordered based on either @Order or implementing
Ordered. This had the unwanted side-effect of possibly logging
unwanted INFO messages if the reflection-based annotation
introspection failed. One cause of this was @ConditionalOnClass when
the referenced class was not on the classpath.

This commit uses the ASM-based annotation metadata reading to
determine the order of a management context configuration class based
on the @Order annotation. The classes are then sorted using a standard
OrderComparator. Note that Ordering via implemented Ordered is not
supported as it cannot be determine without loading the class.
2017-01-26 20:25:23 +00:00
Spring Buildmaster
ed1ce140c0 Next Development Version 2017-01-26 14:20:39 +00:00
Stephane Nicoll
b575be339e Fix endpoint id
See gh-7579
2017-01-26 14:00:48 +01:00
Andy Wilkinson
f823599d1f Replace @PostConstruct validation with setter validation
Closes gh-7579
2017-01-26 09:32:07 +00:00
dreis
d58f38f6f6 Use String.replace() with single char if possible
See gh-8089
2017-01-25 11:01:52 +01:00
Stephane Nicoll
551bfb2c60 Polish contribution
Closes gh-8103
2017-01-25 11:01:52 +01:00
Johnny Lim
32f9e90de5 Replace 'String.length() == 0' with 'String.isEmpty()'
See gh-8103
2017-01-25 11:01:52 +01:00
Dave Syer
98a4c72c50 Clarify PublicMetrics (uniqueness of metric names)
See gh-6404
2017-01-25 09:43:20 +00:00
Johnny Lim
e0de28a1f7 Polish
Closes gh-8076
2017-01-24 13:22:22 +01:00
Madhura Bhave
ca435512c0 Introduce spring-boot-autoconfigure-processor
Add an annotation processor that generates properties files for certain
auto-configuration class annotations. Currently attribute values from
@AutoConfigureOrder, @AutoConfigureBefore, @AutoConfigureAfter and
@ConditionalOnClass annotations are stored.

The properties file will allow optimizations to be added in the
`spring-boot-autoconfigure` project. Primarily by removing the need
to ASM parse as many `.class` files.

See gh-7573
2017-01-23 22:14:56 -08:00
Phillip Webb
2c89d9918f Relocate AutoConfigurations from root package
Move PropertyPlaceholder and MessageSource auto-configuration from the
root package to the `context` subpackage.

Fixes gh-8071
2017-01-23 17:32:45 -08:00
Phillip Webb
5703fb1515 Polish 2017-01-23 16:03:59 -08:00
Andy Wilkinson
b900a3efc8 Update Actuator endpoints to use custom media type
Previously, the actuator's endpoints produced application/json and,
where appropriate, also consumed application/json. Without a custom,
versioned media type, it's impossible for us to make changes to the
endpoints without breaking clients.

This commit introduces a new media type,
application/spring-boot.actuator.v1+json, that is now produced by
default with application/json also being produced if requested.
Endpoints that consume JSON will now also accept content the uses
the new media type in addition to application/json.

Closes gh-7967
2017-01-20 15:31:22 +00:00
Phillip Webb
f3cd0ad22c Polish 2017-01-19 12:44:57 -08:00
Madhura Bhave
e73c6bb2e2 Exclude authorization header from trace by default
Closes gh-7974
2017-01-19 12:12:09 -08:00
Andy Wilkinson
3e88c366ec Polish "Avoid property name collisions when serializing AuditEvent to JSON"
See gh-7990
2017-01-19 12:39:14 +00:00
Johannes Edmeier
fcf36ed091 Avoid property name collisions when serializing AuditEvent to JSON
Previously, in case the data for the audit event contained an entry
with the key "type", the member `type` from the AuditEvent would be
overwritten when rendering to JSON due to the use of @JsonAnyGetter on
the data property.

This commit removes @JsonAnyGetter so that the data map is rendered as
a separate property in the JSON.

Closes gh-7990
2017-01-19 12:33:15 +00:00
Stephane Nicoll
c41ff17dd7 Provide relevant default values for Enums
This commits adds manual metadata for enums that have a default value
since the annotation processor is not able to detect that yet.

Closes gh-7890
2017-01-19 13:19:13 +01:00
Phillip Webb
f42ebe428c Remove JSR-330 configuration annotations
Replace JSR-330 validation annotations from all internal
`@ConfigurationProperties` classes with standard Asserts.

Prior to this commit validation of our own configuration properties
would only occur when the user happens to have compliant JSR-330
implementation on their classpath.

See gh-7579
2017-01-18 20:51:35 -08:00
Phillip Webb
0a6456a748 Always use prefix config annotation attribute
Update use of `@ConfigurationProperties` to prefer the more explicit
`prefix` attribute, rather than `value`.

See gh-7579
2017-01-18 20:49:53 -08:00
Phillip Webb
43d432a527 Polish 2017-01-18 20:35:41 -08:00
Andy Wilkinson
5c9aa41c07 Update InMemoryRichGaugeRepository to support increments
Closes gh-2902
2017-01-17 17:15:26 +00:00
Andy Wilkinson
7fa33cddd7 Merge branch '1.4.x' into 1.5.x 2017-01-17 15:00:01 +00:00
Andy Wilkinson
a02c2d4155 Improve the documentation of Health.Status constants
Closes gh-7784
2017-01-17 14:59:53 +00:00
Johnny Lim
acc36c076d Polish
See gh-8004
2017-01-17 09:53:50 +01:00
Andy Wilkinson
f72799186e Merge branch '1.4.x' into 1.5.x 2017-01-16 11:47:52 +00:00
Andy Wilkinson
a72365e1a2 Expose context hierarchy in beans endpoint
Previously, the beans endpoint would only expose the context that
contained the endpoint. This commit updates the endpoint so that
the context that contains the endpoint and all of its ancestors are
exposed.

In a context hierarhcy, the relation ship is child -> parent and there
is no way to navigate from a parent to a child. As a result, any
contexts that are descendants of the context containing the endpoint
are not exposed.

Closes gh-5188
2017-01-16 11:47:14 +00:00
Stephane Nicoll
8bef0a1e60 Polish contribution
Closes gh-7905
2017-01-16 11:24:36 +01:00
Eddú Meléndez
b2250f4ad8 Add LDAP health actuator
Provide specific health actuator endpoint to verify if LDAP connection
is valid.

See gh-7905
2017-01-16 10:56:49 +01:00
Stephane Nicoll
f21c767356 Polish contribution
Closes gh-7914
2017-01-15 09:45:32 +01:00
Kazuki Shimizu
a6756c9ed3 Allow lowercase logger level on MVC endpoint
See gh-7914
2017-01-15 09:42:40 +01:00
Andy Wilkinson
ae3434ba4c Merge branch '1.4.x' into 1.5.x 2017-01-13 18:45:50 -05:00
Andy Wilkinson
d2201d5284 Correct copyright dates and enforce that starting year is 2012
Closes gh-7923
2017-01-13 18:43:30 -05:00
Phillip Webb
9159c87bf9 Polish 2017-01-10 09:51:11 -05:00
Stephane Nicoll
fefc66625f Merge branch '1.4.x' into 1.5.x 2017-01-08 09:20:00 +01:00
Eddú Meléndez
f896ff9a10 Fix incomplete assertions
Closes gh-7907
2017-01-08 09:12:54 +01:00
Madhura Bhave
4ea47220e9 Match nested paths for insensitive actuators
Update `ManagementWebSecurityAutoConfiguration` to match nested path
for insensitive actuators.

Prior to this commit, when Spring Security was on the classpath
nested paths were considered sensitive (even if the actuator
endpoint was not sensitive). i.e. when setting
`endpoints.env.sensitive=false` `/env` could be accessed without
authentication but `/env/user` could not.

Fixes gh-7868
Closes gh-7881
2017-01-05 18:45:30 -08:00
Johnny Lim
f915ae197a Polish 2017-01-04 09:53:45 +01:00
Madhura Bhave
530c3cd3be Simplify HealthMvcEndpoint security
Expose full health details if management security is disabled or
management role is present.

Fixes gh-7604
Closes gh-7852
2017-01-03 19:00:14 -08:00
Phillip Webb
2fe4d60b47 Add management.cloudfoundry.* meta-data
Update configuration meta-data and appendix to include
`management.cloudfoundry.*` meta-data.

See gh-7108
2017-01-03 17:24:58 -08:00
Phillip Webb
8ccd4db513 Merge branch '1.4.x' into 1.5.x 2017-01-03 15:14:14 -08:00
Phillip Webb
732011987d Fix ManagementContextConfiguration @Order support
Update `ManagementContextConfigurationsImportSelector` to instantiate
classes so that order annotations are respected.

Fixes gh-7814
2017-01-03 15:12:35 -08:00
Phillip Webb
b4b8370632 Fix AuditEventsJmxEndpoint bean name
See gh-6579
2017-01-03 14:43:24 -08:00
Phillip Webb
8a9a61b64f Prevent duplicate JmxEndpoint MBean registration
Update JmxEndpoint support so that the `@ManagedResource` annotation
is no longer required. This prevents both `EndpointMBeanExporter` and
the regular `AnnotationMBeanExporter` from both registering the bean.

Fixes gh-7813
See gh-6579
2017-01-03 14:43:24 -08:00
Phillip Webb
51762642b2 Polish audit event endpoint support
Closes gh-6579
2017-01-02 19:43:26 -08:00
Phillip Webb
5b40eb48e0 Improve MBean without backing Endpoint support
Improve support for MBeans without a backing endpoint by introducing
a `JmxEndpoint` interface. The `JmxEndpoint` is intentionally
similar in design to the `MvcEndpoint` from the `mvc` package and
allows for completely custom JMX beans that are not backed by any
real actuator `Endpoint`.

The `AuditEventsMBean` has been refactored to use the new interface and
has been renamed to `AuditEventsJmxEndpoint`.

See gh-6579
2017-01-02 19:43:14 -08:00
Vedran Pavic
2f1e4f0c02 Add MVC and JMX endpoints to retrieve audit events
Add MVC and JMX specific endpoints that allow audit events to be
retrieved.

See gh-6579
2017-01-02 19:20:35 -08:00
Vedran Pavic
a6d18f714f Add JMX without backing Endpoint support
Decompose `EndpointMBean` to improve support for JMX endpoints without
a backing `Endpoint`.

See gh-6579
2017-01-02 19:19:04 -08:00
Phillip Webb
e1eb48e8b4 Fix warnings 2016-12-30 17:26:25 -08:00
Phillip Webb
a167db7b37 Allow OPTIONS requests in interceptors
Update `MvcEndpointSecurityInterceptor` and
`CloudFoundrySecurityInterceptor` to allow OPTIONS requests to be
processed.

Fixes gh-7720
2016-12-30 14:05:29 -08:00
Phillip Webb
aacf5d660f Update copyright year for changed files 2016-12-30 11:53:51 -08:00
Phillip Webb
367963f29f Polish 2016-12-28 15:41:00 -08:00
Phillip Webb
8b69856fc9 Polish 2016-12-28 15:23:26 -08:00
Stephane Nicoll
8b7055719f Move InMemoryMultiMetricRepository to a separate class
This commit moves the `MultiMetricRepository` implementation from
`InMemoryMetricRepository` to `InMemoryMultiMetricRepository`. Both
implementations can share the same underlying store (and are for backward
compatible reasons).

The side effect is that `reset` now works as expected for a group.

Closes gh-7687
2016-12-28 18:16:10 +01:00
Phillip Webb
3af5ae2a26 Polish ObjectProvider names
Consistently use the simple name for ObjectProvider parameter and
field names. For example:

  `ObjectProvider<Something> something`

rather than

  `ObjectProvider<Something> somethingProvider`
2016-12-27 15:04:06 -08:00
Phillip Webb
e0541d0f74 Polish 2016-12-27 14:48:44 -08:00
Stephane Nicoll
0d4ef3dbdb Fix formatting 2016-12-27 11:41:53 +01:00
Stephane Nicoll
d0fa72a169 Filter AbstractRoutingDataSource from health indicator
Closes gh-6806
2016-12-27 10:11:52 +01:00
Spring Buildmaster
9057f9ae1f Next development version 2016-12-23 00:15:23 +00:00
Stephane Nicoll
5d909a969f Polish contribution
Closes gh-6613
2016-12-22 11:44:49 +01:00
Eddú Meléndez
53d25999f3 Add support for multiple beans in the Flyway and Liquibase endpoints
Closes gh-6610
See gh-6613
2016-12-22 11:44:12 +01:00
Phillip Webb
b87e02dde0 Polish Spring Integration metrics support
See gh-7722
2016-12-21 20:18:06 -08:00
Artem Bilan
d69e43b433 Refactor Spring Integration metrics support
Update Spring Integration metrics support since Spring Integration
`4.3.6`+ no longer needs `spring-integration-jmx` enable
`MessageChannel`, `MessageHandler` and `MessageSource` metrics.

- Add `IntegrationManagementConfiguration` conditional auto-configuration
  to provide `@EnableIntegrationManagement` when JMX is `enabled` or there
  is no `IntegrationManagementConfigurer.MANAGEMENT_CONFIGURER_NAME` bean.
  By default this bean doesn't exist and you explicitly should declare it
  (e.g. via `@EnableIntegrationManagement`) if you would like to collect
  metrics. At the same time Spring Integration enables it when JMX
  management is present (that is a purpose of that new
  `IntegrationManagementConfiguration`)

- Change `SpringIntegrationMetricReader` to read metrics from the
  `IntegrationManagementConfigurer`, not `IntegrationMBeanExporter`

- Change `PublicMetricsAutoConfiguration` to register
  `IntegrationManagementConfigurer.MANAGEMENT_CONFIGURER_NAME` bean if
  not present. Since we are here in `actuator`, therefore we are
  interested in the metrics for SI as well.

- Since we don't need JMX for the metrics any more, remove SI-JMX
  dependency from the `spring-boot-starter-integration`.

- Remove `IntegrationManagementConfiguration` modification from the
  `integrationMbeanExporter()`, since that looks like mutation of an
  external object, when end-user would prefer their own options.
  Therefore we don't need `ObjectProvider<IntegrationManagementConfigurer>`, too

- Add missed `MessageSourceMetrics` gathering for the
  `SpringIntegrationMetricReader`

Closes gh-7722
2016-12-21 20:18:06 -08:00
Johnny Lim
e12b4a944f Polish 2016-12-21 20:18:04 -08:00
Phillip Webb
38f7389eab Polish loggers 2016-12-20 21:16:40 -08:00
Phillip Webb
c76bd2d81e Refine error message from Endpoint MVC security
Update the error message to return less information to the client.
Details of how to disable security are now written to the log instead.

See gh-7605
See gh-7634
2016-12-20 18:47:39 -08:00
Madhura Bhave
38eeae2166 Send error with message from Endpoint MVC security
Update `MvcEndpointSecurityInterceptor` to that it sends an error in the
same way as Spring Security. Prior to this commit the `ErrorController`
would not handle endpoint security errors.

Fixes gh-7605
Closes gh-7634
2016-12-20 18:27:25 -08:00
Phillip Webb
dba8ef2ba8 Polish CF management skip SSL opt-in
See gh-7629
See gh-7655
2016-12-20 18:25:32 -08:00
Madhura Bhave
34712cbf76 Switch CF management skip SSL to opt-in
Change CloudFoundryActuatorAutoConfiguration so that skipping of SSL
verification is now opt-in rather than enabled by default.

Fixes gh-7629
Closes gh-7655
2016-12-20 18:24:15 -08:00
Phillip Webb
06a7ab0cd5 Polish ReservoirFactory support
Polish Dropwizrd reservoir support including a refactor of
`ReservoirFactory` to allow reservoirs to be created based on a
metric name.

See gh-5199
See gh-7105
2016-12-20 15:12:14 -08:00
Lucas Saldanha
1fc2e87053 Enable custom Reservoir with Dropwizard metrics
Uses the ReservoirFactory to customize the implementation of
the Reservoir that will be used when creating Timer and Histogram
in the DropwizardMetricServices.

Fixes gh-5199
Closes gh-7105
2016-12-20 14:56:29 -08:00
Phillip Webb
d15f3548be Polish 2016-12-19 13:12:03 -08:00
Phillip Webb
6121208cbb Polish formatting 2016-12-19 12:47:03 -08:00
Phillip Webb
4b9cba351b Merge branch '1.4.x' into 1.5.x 2016-12-19 12:36:57 -08:00
Phillip Webb
bd74c3d327 Polish formatting 2016-12-19 12:25:09 -08:00
Stephane Nicoll
684be0f048 Polish contribution
Closes gh-6852
2016-12-16 14:19:20 +01:00
Vedran Pavic
899f7aa8f0 Add constants for supported audit event types
See gh-6582
2016-12-16 13:59:50 +01:00
Stephane Nicoll
f560f338ab Polish contribution
Closes gh-7219
2016-12-16 11:58:26 +01:00
Vedran Pavic
60e054d0e4 Add LoggersEndpointMBean
See gh-7219
2016-12-16 11:05:17 +01:00
Eddú Meléndez
fc09a23991 Add missing actuator metadata
Health metadata for cassandra and couchbase is added.

See gh-7632
2016-12-14 19:16:42 +01:00
Johnny Lim
6d1b752ffe Polish
Closes gh-7552
2016-12-14 19:14:24 +01:00
Oscar Utbult
38713c473f Remove redundant array creation for calling varargs method
Closes gh-7551
2016-12-14 19:12:08 +01:00
Andy Wilkinson
595679bed4 Disable management security when testing Jolokia endpoint 2016-12-13 13:02:40 +00:00
Andy Wilkinson
391a760c3c Merge branch '1.4.x' into 1.5.x 2016-12-13 09:44:16 +00:00
Andy Wilkinson
4ec95b8308 Ensure that JolokiaMvcEndpoint destroys underlying controller
Closes gh-7606
2016-12-13 09:42:14 +00:00
Dave Syer
1baf3c63c4 Make the Spring Security part of CF autoconfig conditional
Otherwise you get a class not found exception at runtime in
CF when Spring Securtity is not on the classpath.
2016-12-12 15:05:48 +00:00
Dave Syer
cc8ecb6ff5 Clear VCAP_APPLICATION after tests
So that other CF tests do not fail.
2016-12-12 15:05:07 +00:00
Madhura Bhave
5d8e00cb56 Fix HealthMvcEndpointTests
See gh-7569
2016-12-06 13:18:10 -08:00
Madhura Bhave
1be5812cf0 Require ACTUATOR role rather than ADMIN
Update management security to require an `ACTUATOR` role rather than
`ADMIN` by default. This should reduce the risk of users accidentally
exposing actuator endpoints because they happen to use a role named
`ADMIN`.

Fixes gh-7569
2016-12-05 17:58:16 -08:00
Madhura Bhave
95be208f0f Use IgnoredRequestCustomizer to ignore paths
Update `SpringBootWebSecurityConfiguration` to ignore requests by
delegating to `IgnoredRequestCustomizer` beans. This allows a single
Spring Boot `WebSecurityConfigurer<WebSecurity>` bean to be used which
prevents potential exceptions caused by duplicate `@Order` values.

Fixes gh-7106
2016-12-05 17:57:18 -08:00
Madhura Bhave
d09aafacda Add a security interceptor for actuator endpoints
Update `AbstractEndpointHandlerMapping` to support a security
interceptor that can be used to enforce endpoint security.

Fixes gh-6889
2016-12-05 17:57:00 -08:00
Andy Wilkinson
967625db1e Replace field injection with constructor injection in config classes
Closes gh-7563
2016-12-05 10:48:01 +00:00
Andy Wilkinson
1464425d64 Remove use of @Component from classes that are not scanned
Closes gh-7549
2016-12-02 17:57:21 +00:00
Stephane Nicoll
ee72e788ed Rename spring-boot-junit-runners to spring-boot-test-support
Closes gh-7421
2016-12-01 16:25:47 +01:00
Stephane Nicoll
85de72c0d0 Merge branch '1.4.x' into 1.5.x 2016-12-01 15:26:06 +01:00
Stephane Nicoll
2a85a2557d Fix health indicator auto-configuration order
Previously, the health auto-configuration `AutoconfigureOrder` entry for
couchbase was referring to the standard couchbase auto-configuration that
is not responsible to configure the `CouchbaseOperations` bean. Yet, the
health indicator implementation was relying on the presence of such a
bean.

This commit fixes the `AutoconfigureOrder` entry so that it refers to
`CouchbaseDataAutoConfiguration` now.

Closes gh-7543
2016-12-01 15:25:51 +01:00
Andy Wilkinson
9c20ada927 Merge branch '1.4.x' into 1.5.x 2016-12-01 13:26:45 +00:00
Andy Wilkinson
356edc725c Handle request mappings with regular expressions in MetricsFilter
Closes gh-7503
2016-12-01 13:22:55 +00:00
Andy Wilkinson
2be554456e Introduce SearchStrategy.ANCESTORS as a replacement for .PARENTS
Closes gh-6763
2016-11-28 15:41:53 +00:00
Andy Wilkinson
dce1487424 Merge branch '1.4.x' into 1.5.x 2016-11-24 20:57:34 +00:00
Andy Wilkinson
e19c6245ef Consider endpoints.sensitive when endpoints.health.sensitive is not set
Closes gh-7476
2016-11-24 20:57:29 +00:00
Andy Wilkinson
f5dd90815b Polishing: fix some compiler warnings 2016-11-22 11:07:51 +00:00
Phillip Webb
1657120286 Move ModifiedClassPathRunner to its own module
Migrate `ModifiedClassPathRunner` from `spring-boot` test source to
its own module.

Fixes gh-7420
2016-11-18 17:27:54 -08:00
Phillip Webb
c2c5611f77 Polish 2016-11-18 15:58:56 -08:00
Madhura Bhave
3a3228fc70 Add CORS interceptor for Cloud Foundry actuators
This interceptor processes the response with CORS headers
and apepars before the Cloud Foundry security interceptor.

See gh-7108
2016-11-18 09:26:31 -08:00
Andy Wilkinson
1cd781b242 Make spring-boot-test compatible with Mockito 2.1 and 2.2
We use some internal Mockito classes and some  breaking API changes
have been made to them in Mockito 2. This commit introduces a utility
class, SpringBootMockUtil, to shield our code from these differences.
Mockito 1 is called directly and Mockito 2 is called via reflection.

To allow these changes to be tested, FilteredClassPathRunner has been
enhanced to also support overriding a dependency on the class path.
As a result it has been renamed to ModifiedClassPathRunner. The new
ClassPathOverrides annotation can be used to provide the Maven
coordinates of one or more dependencies that should be resolved and
added to the class path. Such additions are added to the start of
the class path so that they override any existing dependency that
contains the same classes.

Closes gh-6520
2016-11-18 16:39:44 +00:00
Andy Wilkinson
5527e3fdad Fix SpringApplicationHierarchyTests following latest Neo4j changes
See gh-7391
2016-11-18 11:54:05 +00:00
Johnny Lim
8038882d46 Polish
Closes gh-7403
2016-11-16 13:36:51 -08:00
Andy Wilkinson
387a406aad Merge branch '1.4.x' into 1.5.x 2016-11-16 09:13:17 +00:00
Phillip Webb
449b42ffa0 Polish LinksEnhancer to use endpoint name
See gh-7164
See gh-7132
2016-11-15 18:07:50 -08:00
Madhura Bhave
ada02232b9 Change LinksEnhancer to use endpoint name
Update `LinksEnhancer` to use NamedEndpoint names as rel names. If the
endpoint name is not available, fallback to endpoint path. Allow
multiple hrefs per rel if path is different.

Fixes gh-7132
Closes gh-7164
2016-11-15 18:03:26 -08:00
Madhura Bhave
0e3a3df6f4 Return log levels in /loggers endpoint payload
Update `LoggersEndpoint` to additionally return the log levels actually
supported by the system.

Fixes gh-7396
2016-11-15 14:32:02 -08:00
Phillip Webb
764f13453a Merge branch '1.4.x' into 1.5.x 2016-11-15 13:58:54 -08:00
Phillip Webb
bacf0878af Polish 2016-11-15 10:40:21 -08:00
Andy Wilkinson
24cc5d5644 Give javac's type inferencing a helping hand 2016-11-15 13:29:19 +00:00
Andy Wilkinson
22e456a177 Merge branch '1.4.x' into 1.5.x 2016-11-15 13:14:30 +00:00
Madhura Bhave
2697bf2ba1 Add Content-Type to allowed headers for CloudFoundry actuators
See gh-7108
2016-11-11 12:09:16 -08:00
Madhura Bhave
af61278213 Extend HealthMvcEndpoint for Cloud Foundry
The CloudFoundryHealthMvcEndpoint does not perform additional
security checks since security is handled by the interceptor.

See gh-7108
2016-11-09 11:04:51 -08:00
Madhura Bhave
a3bcb2778f Add message to response body for Cloud Foundry security error
See gh-7108
2016-11-09 10:54:56 -08:00
Spring Buildmaster
e712a9ba8c Next Development Version 2016-11-08 16:55:37 +00:00
Andy Wilkinson
2e76687d17 Merge branch '1.4.x' into 1.5.x 2016-11-08 13:50:41 +00:00
Andy Wilkinson
5f44598d8b Remove use of static import that Checkstyle prohibits 2016-11-08 13:50:15 +00:00
Andy Wilkinson
218d28f74c Merge branch '1.4.x' into 1.5.x 2016-11-08 13:22:58 +00:00
Andy Wilkinson
33dcd853fd Ensure that health endpoint remains insecure without Spring Security
The changes made in 6a2ac080 mean that getSecurity() on
ManagementServerProperties will no longer return null when Spring
Security is on the classpath. This had the unwanted side-effect of
causing the health endpoint to hide its details when Spring Security
was not on the classpath.

This commit reinstates the previous behaviour by only considering
the health endpoint to be secure if Spring Security is on the
classpath and management.security.enabled is true.

Closes gh-7345
2016-11-08 13:18:05 +00:00
Madhura Bhave
82f89b4ac1 Add custom headers to allowed CORS headers for CF actuators
Update CORS configuration to support Authorization and X-Cf-App-Instance.

See gh-7108
2016-11-07 15:37:09 -08:00
Stephane Nicoll
01e66ecbd5 Merge branch '1.4.x' into 1.5.x 2016-11-05 11:15:27 +01:00
Stephane Nicoll
2c71cb8efd Polish 2016-11-05 11:10:17 +01:00
Stephane Nicoll
4407194c00 Replace sample by integration test
Closes gh-3888
2016-11-05 11:09:36 +01:00
Phillip Webb
6c76353682 Default management.cloudfoundry.enabled to true
Update `CloudFoundryActuatorAutoConfiguration` so that it is enabled
when `management.cloudfoundry.enabled` is missing.

See gh-7108
2016-11-04 17:26:25 -07:00
Madhura Bhave
a77cfc3b0e Skip SSL validation when calling Cloud Foundry
Update CloudFoundrySecurityService so that SSL validation is not
required. We're unlikely to have configured public keys for the
REST endpoints we need to call. Since the endpoints are provided via
environment variables we can implicitly trust them.

See gh-7108
2016-11-04 17:26:25 -07:00
Madhura Bhave
862a06eb7a Add POST to allowed CORS methods for CF actuators
Update CORS configuration to support POST.

See gh-7108
2016-11-04 16:41:49 -07:00
Madhura Bhave
1005feb27d Update discovery endpoint to respect AccessLevel
Change `CloudFoundryDiscoveryMvcEndpoint` so that `AccessLevel` rights
are consulted so that only accessible links are returned.

See gh-7108
2016-11-04 16:41:49 -07:00
Madhura Bhave
340f1d5574 Add security for Cloud Foundry actuators
Add security to Cloud Foundry actuator endpoints. Security is enforced
by a `HanderInterceptor` on `CloudFoundryEndpointHandlerMapping`. Each
endpoint call expects an 'Authorization' header containing a bearer
token. The token signature is checked against the UAA public keys then
passed to the Cloud Controller to obtain an ultimate access level.

The client may either have 'RESTRICTED' or FULL' access, with the latter
only providing access to a limited set of endpoints.

See gh-7108
2016-11-04 16:41:48 -07:00
Phillip Webb
81c5753f4d Merge branch '1.4.x' into 1.5.x 2016-11-03 14:49:38 -07:00
Phillip Webb
6a2ac080ac Create our own SessionCreationPolicy enum
Update `ManagementServerProperties` so that `security.sessions` no
longer uses `SessionCreationPolicy` from Spring Security. We now
use our own enun which allows `management.security.*` properties to
be set without the risk of a `ClassNotFoundException`.

Fixes gh-3888
2016-11-03 14:36:49 -07:00
Andy Wilkinson
bdfceae24c Merge branch '1.4.x' into 1.5.x 2016-11-03 20:15:13 +00:00
Andy Wilkinson
97e5e32496 Make sure the MetricsFilter uses committed response's status
Previously, if an exception was thrown during request handling after
the response had been committed, i.e. after the status and headers
had been written, the metrics filter would assume that it was a 500
response. This was potentially inaccurate as the status had already
been sent to the client and before the exception was thrown and it
may have been something other than a 500.

This commit updates MetricsFilter so that it will use the
status from the response if the response has been committed even when
an exception is thrown.

Closes gh-7277
2016-11-03 20:08:31 +00:00
Andy Wilkinson
fe50b2019e Merge branch '1.4.x' into 1.5.x 2016-11-01 13:52:51 +00:00
Andy Wilkinson
b191974faa Reflect Java 7/8 differences in javadoc for metric repository auto-config
Closes gh-6985
2016-11-01 13:51:46 +00:00
Phillip Webb
5b66ffbb4b Merge branch '1.4.x' into 1.5.x 2016-10-31 23:09:36 -07:00
Phillip Webb
60355e0e11 Fix ResourceHttpRequestHandler delegate
Fix ResourceHttpRequestHandler to set the ServletContext following the
Spring Framework update for SPR-14851.
2016-10-31 15:04:43 -07:00
Johnny Lim
7bb63238ab Fix typo
Closes gh-7253
2016-10-31 11:37:52 +01:00
Stephane Nicoll
c4d8fb1c09 Merge branch '1.4.x' into 1.5.x 2016-10-30 10:59:02 +01:00
Stephane Nicoll
6d50e26b70 Polish contribution
Closes gh-7215
2016-10-30 10:57:58 +01:00
Madhura Bhave
9bde1e89cb Move some tests to AbstractEndpointHandlerMapping
See gh-7108
2016-10-24 10:38:53 -07:00
Phillip Webb
a448183681 Polish /loggers actuator endpoint
See gh-7086
2016-10-24 10:24:36 -07:00
Ben Hale
06cb4fcca5 Add /loggers actuator endpoint
Add `LoggersEndpoint` that can enables listing and configuration of log
levels. This actuator builds on top of the `LoggingSystem` abstraction
and implements support for Logback, Log4J2, and JUL.  The LoggingSystem
interface is modified to require each implementation to list the
configuration of all loggers as well as an individual logger by name.

The MVC endpoint exposes these behaviors at `GET /loggers` and
`GET /loggers/{name}` (much like the metrics actuator).

In addition `POST /loggers/{name}` allows users to modify the level for a given
logger. This modification is passed to the logging implementation, which
then decides, as an internal implementation detail, what the final outcome
of the modification is (e.g. changing all unconfigured children). Users
are then expected to request the listing of all loggers to see what has
changed internally to the logging system.

Closes gh-7086
2016-10-24 10:24:36 -07:00
Stephane Nicoll
aec85787d2 Merge branch '1.4.x' into 1.5.x 2016-10-24 10:08:06 +02:00
Johnny Lim
eb7c0e4dc8 Remove unused
Closes gh-6966
2016-10-24 10:07:10 +02:00
Phillip Webb
2ba978b4ad Polish 2016-10-21 10:23:13 -07:00
Madhura Bhave
ab81d993e6 Add CloudFoundryDiscoveryMvcEndpoint
Update Cloud Foundry support with a discovery endpoint that shows what
endpoints are available.

See gh-7108
2016-10-21 10:16:09 -07:00
Madhura Bhave
7afb161fcf Add CloudFoundry EndpointHandlerMapping
Add a CloudFoundryEndpointHandlerMapping that can expose actuator
endpoints for Cloud Foundry "appsmanager" to use.

See gh-7108
2016-10-21 10:06:34 -07:00
Andy Wilkinson
a416f496c0 Clean up deprecation and unused code warnings 2016-10-18 20:43:05 +01:00
Madhura Bhave
7352d8e303 Improve EndpointHandlerMapping subclassing support
Update EndpointHandlerMapping so that it can be subclasses easily.
Subclasses can override the `path` that is used to map the endpoint,
allowing different mapping strategies to be used.

See gh-7108
2016-10-12 13:32:39 -07:00
Madhura Bhave
0be8a30276 Add EndpointHandlerMapping.getEndpoints(Class)
Add an additional method to EndpointHandlerMapping which allows
endpoints of a specific type to be returned.

See gh-7108
2016-10-12 13:32:38 -07:00
Madhura Bhave
7f1ff968a1 Support NamedMvcEndpoints
Introduce a new NamedMvcEndpoint interface which can be used when an
MvcEndpoint also has a logical name. Existing MvcEndpoints have been
reworked to implement the NamedMvcEndpoint interface.

Fixes gh-7156
2016-10-12 13:32:38 -07:00
Madhura Bhave
0f5007d69d Drop superfluous disabled check
Remove EndpointWebMvcManagementContextConfiguration `disabled` logic
since the configuration should even be processed when the management
port is `-1`.

Closes gh-7154
2016-10-12 12:19:35 -07:00
Madhura Bhave
84d0e8acd8 Fix EndpointHandlerMappingTests path references
Fix the TestEndpoint constructor to use an ID parameter rather than
path.
2016-10-12 12:19:35 -07:00
Phillip Webb
d818a09ed8 Polish 2016-10-11 23:38:14 -07:00
Stephane Nicoll
cfee9bab81 Deprecate remote shell support
Closes gh-7044
2016-10-11 17:39:28 +02:00
Andy Wilkinson
9b6fa1e8d7 Separate conditions that did and did not match in auto-config endpoint
Closes gh-7122
2016-10-06 17:15:38 +01:00
Stephane Nicoll
cf28663cd7 Deprecate commons-dbcp 1
Closes gh-6787
2016-10-05 15:21:09 +02:00
Phillip Webb
f2b0fa284e Merge branch '1.4.x' into 1.5.x 2016-10-03 22:38:22 -07:00
Phillip Webb
3326841a97 Formatting 2016-10-03 22:19:35 -07:00
Phillip Webb
39ed0d4dfb Polish 2016-10-03 21:58:13 -07:00
Stephane Nicoll
3d9c56fbf3 Merge branch '1.4.x' into 1.5.x
# Conflicts:
#	spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java
#	spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesAutoConfigurationTests.java
2016-10-03 10:42:07 +02:00
Stephane Nicoll
8c1b736bb0 Fix list property to be mutable
Closes gh-7068
2016-10-03 10:40:46 +02:00