From 568d716c991da79824f72bf25bae3e09b5ee3a99 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Mon, 25 Apr 2016 16:44:43 +0100 Subject: [PATCH 1/2] Move OAuth2ClientContextFilter back before the main security filter It sometimes has to catch an exception from the security filter so it needs to be before, and somehow this hasn't been a problem up to now, but probably only by some fluke. Fixes gh-5792 --- .../oauth2/client/OAuth2RestOperationsConfiguration.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java index a5c316972b..7f0b7ffabe 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java @@ -26,6 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.condition.ConditionalOnNotWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.boot.autoconfigure.security.SecurityProperties; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2RestOperationsConfiguration.OAuth2ClientIdCondition; import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.boot.context.embedded.FilterRegistrationBean; @@ -116,10 +117,10 @@ public class OAuth2RestOperationsConfiguration { @Bean public FilterRegistrationBean oauth2ClientFilterRegistration( - OAuth2ClientContextFilter filter) { + OAuth2ClientContextFilter filter, SecurityProperties security) { FilterRegistrationBean registration = new FilterRegistrationBean(); registration.setFilter(filter); - registration.setOrder(-100); + registration.setOrder(security.getFilterOrder() - 10); return registration; } From 247685e9923093a22d53d03730cd365c7d9994ab Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 26 Apr 2016 08:29:20 +0200 Subject: [PATCH 2/2] Add missing `@Documented` Closes gh-5786 --- .../actuate/condition/ConditionalOnEnabledEndpoint.java | 4 +++- .../autoconfigure/condition/ConditionalOnExpression.java | 6 ++++-- .../boot/autoconfigure/condition/ConditionalOnProperty.java | 6 ++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/ConditionalOnEnabledEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/ConditionalOnEnabledEndpoint.java index e37539d08a..1363e1fc8a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/ConditionalOnEnabledEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/condition/ConditionalOnEnabledEndpoint.java @@ -16,6 +16,7 @@ package org.springframework.boot.actuate.condition; +import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -33,9 +34,10 @@ import org.springframework.context.annotation.Conditional; * @author Andy Wilkinson * @since 1.2.4 */ -@Conditional(OnEnabledEndpointCondition.class) @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.METHOD, ElementType.TYPE }) +@Conditional(OnEnabledEndpointCondition.class) +@Documented public @interface ConditionalOnEnabledEndpoint { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpression.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpression.java index 9e82bfc59f..1997eb42a2 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpression.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnExpression.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 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. @@ -16,6 +16,7 @@ package org.springframework.boot.autoconfigure.condition; +import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -29,9 +30,10 @@ import org.springframework.context.annotation.Conditional; * * @author Dave Syer */ -@Conditional(OnExpressionCondition.class) @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.METHOD }) +@Documented +@Conditional(OnExpressionCondition.class) public @interface ConditionalOnExpression { /** diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.java index 2e398005d9..de09c90acf 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionalOnProperty.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2015 the original author or authors. + * Copyright 2012-2016 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. @@ -16,6 +16,7 @@ package org.springframework.boot.autoconfigure.condition; +import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -76,9 +77,10 @@ import org.springframework.core.env.Environment; * @author Phillip Webb * @since 1.1.0 */ -@Conditional(OnPropertyCondition.class) @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE, ElementType.METHOD }) +@Documented +@Conditional(OnPropertyCondition.class) public @interface ConditionalOnProperty { /**