diff --git a/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/discovery/EnableStickyFilter.java b/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/discovery/EnableStickyFilter.java deleted file mode 100644 index 2828a67..0000000 --- a/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/discovery/EnableStickyFilter.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2013-2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.cloud.cloudfoundry.discovery; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.context.annotation.Import; - -/** - * @author Dave Syer - * - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Import(StickyFilterConfiguration.class) -public @interface EnableStickyFilter { - -} \ No newline at end of file diff --git a/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/discovery/StickyFilterConfiguration.java b/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/discovery/StickyFilterConfiguration.java deleted file mode 100644 index cf63dff..0000000 --- a/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/discovery/StickyFilterConfiguration.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2013-2014 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.cloud.cloudfoundry.discovery; - -import java.io.IOException; -import java.util.UUID; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.embedded.FilterRegistrationBean; -import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; -import org.springframework.web.filter.OncePerRequestFilter; - -/** - * @author Dave Syer - */ -@Configuration -public class StickyFilterConfiguration { - - private String cookie = UUID.randomUUID().toString(); - - @Autowired - public void init(EurekaInstanceConfigBean eurekaInstance) { - eurekaInstance.getMetadataMap().put("cookie", cookie); - } - - @Bean - public FilterRegistrationBean stickyCloudFoundryFilter() { - FilterRegistrationBean filter = new FilterRegistrationBean(); - filter.setOrder(Ordered.LOWEST_PRECEDENCE); - filter.setFilter(new OncePerRequestFilter() { - @Override - protected void doFilterInternal(HttpServletRequest request, - HttpServletResponse response, FilterChain filterChain) - throws ServletException, IOException { - if (!response.containsHeader("Set-Cookie")) { - response.addCookie(new Cookie("JSESSIONID", cookie)); - } - filterChain.doFilter(request, response); - } - }); - return filter; - } - -} \ No newline at end of file diff --git a/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessor.java b/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessor.java index f4ade56..f2201ec 100644 --- a/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessor.java +++ b/spring-cloud-cloudfoundry-web/src/main/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessor.java @@ -67,9 +67,9 @@ implements EnvironmentPostProcessor, Ordered { source.put("security.oauth2.resource.userInfoUri", authDomain + "/userinfo"); source.put("security.oauth2.resource.keyUri", authDomain + "/token_key"); - source.put("security.oauth2.resource.accessTokenUri", + source.put("security.oauth2.client.accessTokenUri", authDomain + "/oauth/token"); - source.put("security.oauth2.resource.authorizationUri", + source.put("security.oauth2.client.authorizationUri", authDomain + "/oauth/authorization"); } else { diff --git a/spring-cloud-cloudfoundry-web/src/test/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessorTests.java b/spring-cloud-cloudfoundry-web/src/test/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessorTests.java index f89bd7c..4e4dae7 100644 --- a/spring-cloud-cloudfoundry-web/src/test/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessorTests.java +++ b/spring-cloud-cloudfoundry-web/src/test/java/org/springframework/cloud/cloudfoundry/environment/VcapServiceCredentialsEnvironmentPostProcessorTests.java @@ -72,6 +72,15 @@ public class VcapServiceCredentialsEnvironmentPostProcessorTests { .resolvePlaceholders("${security.oauth2.client.accessTokenUri}")); } + @Test + public void addTokenUriAuthDomain() { + EnvironmentTestUtils.addEnvironment(this.environment, + "vcap.services.sso.credentials.auth_domain:http://example.com"); + this.listener.postProcessEnvironment(this.environment, new SpringApplication()); + assertEquals("http://example.com/oauth/token", this.environment + .resolvePlaceholders("${security.oauth2.client.accessTokenUri}")); + } + @Test public void addUserInfoUri() { EnvironmentTestUtils.addEnvironment(this.environment, @@ -84,7 +93,7 @@ public class VcapServiceCredentialsEnvironmentPostProcessorTests { @Test public void addServiceId() { EnvironmentTestUtils.addEnvironment(this.environment, - "vcap.services.my.credentials.tokenUri:http://example.com", + "vcap.services.my.credentials.accessTokenUri:http://example.com", "security.oauth2.sso.serviceId:my"); this.listener.postProcessEnvironment(this.environment, new SpringApplication()); assertEquals("http://example.com", this.environment