More detail on credentials for discovery

This commit is contained in:
Dave Syer
2016-04-29 13:49:13 +01:00
parent 538ceeee7a
commit 660dabdf9c
4 changed files with 11 additions and 3 deletions

View File

@@ -16,5 +16,5 @@ implementation of Spring Cloud Commons `DiscoveryClient` so you can
`@EnableDiscoveryClient` and provide your credentials as
`spring.cloud.cloudfoundry.discovery.[email,password]` and then you
can use the `DiscoveryClient` directly or via a `LoadBalancerClient`
(also `*.url` if you are not connecting to [Pivotal Web
Services](https://run.pivotal.io)).
(also `*.url` if you are not connecting to
https://run.pivotal.io[Pivotal Web Services]).

View File

@@ -9,6 +9,11 @@ the fact that it has to get an access token from Cloud Foundry.
include::quickstart.adoc[]
The `DiscoveryClient` can lists all the apps in a space, according to
the credentials it is authenticated with, where the space defaults to
the one the client is running in (if any). If neither org nor space
are configured, they default per the user's profile in Cloud Foundry.
== Single Sign On
NOTE: All of the OAuth2 SSO and resource server features moved to Spring Boot

View File

@@ -29,6 +29,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
/**
* @author Josh Long
@@ -54,7 +55,7 @@ public class CloudFoundryDiscoveryClientConfiguration {
public CloudFoundryClient cloudFoundryClient(CloudCredentials cc)
throws MalformedURLException {
CloudFoundryClient cloudFoundryClient;
if (this.discovery.getOrg() != null && this.discovery.getSpace() != null) {
if (StringUtils.hasText(this.discovery.getOrg()) && StringUtils.hasText(this.discovery.getSpace())) {
cloudFoundryClient = new CloudFoundryClient(cc,
URI.create(this.discovery.getUrl()).toURL(), this.discovery.getOrg(),
this.discovery.getSpace());

View File

@@ -16,6 +16,7 @@
package org.springframework.cloud.cloudfoundry.discovery;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@@ -47,6 +48,7 @@ public class CloudFoundryDiscoveryProperties {
/**
* Space name to authenticate with (default to user's default).
*/
@Value("${vcap.application.space_name:}")
private String space;
/**