More detail on credentials for discovery
This commit is contained in:
@@ -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]).
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user