Add support for OAuth relay in zuul proxy

This commit is contained in:
Dave Syer
2014-08-27 18:52:59 +01:00
parent 73e989320a
commit 75fdc89d32
2 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
/*
* 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.platform.cli.compiler;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
import org.springframework.boot.cli.compiler.AstUtils;
import org.springframework.boot.cli.compiler.CompilerAutoConfiguration;
import org.springframework.boot.cli.compiler.DependencyCustomizer;
/**
* @author Dave Syer
*
*/
public class CloudfoundryResourceCompilerAutoConfiguration extends CompilerAutoConfiguration {
@Override
public boolean matches(ClassNode classNode) {
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableCloudfoundryResource");
}
@Override
public void applyDependencies(DependencyCustomizer dependencies) {
dependencies
.ifAnyMissingClasses(
"org.springframework.platform.cloudfoundry.resource.EnableCloudfoundryResource")
.add("spring-platform-starter-cloudfoundry")
.add("org.springframework.security.oauth:spring-security-oauth2:2.0.3.BUILD-SNAPSHOT");
}
@Override
public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
imports.addImports(
"org.springframework.platform.cloudfoundry.resource.EnableCloudfoundryResource",
"org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter");
}
}

View File

@@ -1,5 +1,6 @@
org.springframework.platform.cli.compiler.SpringPlatformCompilerAutoConfiguration
org.springframework.platform.cli.compiler.ConfigServerCompilerAutoConfiguration
org.springframework.platform.cli.compiler.CloudfoundryResourceCompilerAutoConfiguration
org.springframework.platform.cli.compiler.CloudfoundrySsoCompilerAutoConfiguration
org.springframework.platform.cli.compiler.EurekaClientCompilerAutoConfiguration
org.springframework.platform.cli.compiler.HystrixCompilerAutoConfiguration