public CloudFoundryOperations getCloudFoundryOperations(CloudCredentials credentials, URL url, String orgName, String spaceName, boolean selfsigned) { // Proxies are always updated on each client call by the // CloudFoundryServerBehaviour Request as well as the client login // handler // therefore it is not critical to set the proxy in the client on // client // creation HttpProxyConfiguration proxyConfiguration = getProxy(url); return new CloudFoundryClient(credentials, url, orgName, spaceName, proxyConfiguration, selfsigned); }
public CloudFoundryOperations getCloudFoundryOperations(CloudCredentials credentials, URL url, CloudSpace session, boolean selfSigned) { // Proxies are always updated on each client call by the // CloudFoundryServerBehaviour Request as well as the client login // handler // therefore it is not critical to set the proxy in the client on // client // creation HttpProxyConfiguration proxyConfiguration = getProxy(url); return session != null ? new CloudFoundryClient(credentials, url, session, selfSigned) : new CloudFoundryClient(credentials, url, proxyConfiguration, selfSigned); }
public CloudFoundryOperations getCloudFoundryOperations(String cloudControllerUrl, boolean selfSigned) throws MalformedURLException { URL url = new URL(cloudControllerUrl); // Proxies are always updated on each client call by the // CloudFoundryServerBehaviour Request as well as the client login // handler // therefore it is not critical to set the proxy in the client on client // creation HttpProxyConfiguration proxyConfiguration = getProxy(url); return new CloudFoundryClient(url, proxyConfiguration, selfSigned); }
@Bean @ConditionalOnMissingBean public CloudFoundryClient cloudFoundryClient(CloudCredentials cc) throws MalformedURLException { URI uri = URI.create(this.loggregatorSourceProperties.getCloudFoundryApi()); CloudFoundryClient cloudFoundryClient = new CloudFoundryClient(cc, uri.toURL()); cloudFoundryClient.login(); return cloudFoundryClient; }
@Bean @ConditionalOnMissingBean public CloudFoundryClient cloudFoundryClient(CloudCredentials cc) throws MalformedURLException { URI uri = URI.create(this.loggregatorSourceProperties.getCloudFoundryApi()); CloudFoundryClient cloudFoundryClient = new CloudFoundryClient(cc, uri.toURL()); cloudFoundryClient.login(); return cloudFoundryClient; }
/** * given the username and password, get the UAA token * @param username * @param password * @param targetAPI * @return * @throws MalformedURLException * @throws CloudFoundryException */ public static String getBluemixToken(String username, String password, String targetAPI, PrintStream printStream) throws MalformedURLException, CloudFoundryException { CloudCredentials cloudCredentials = new CloudCredentials(username, password); URL url = new URL(targetAPI); HttpProxyConfiguration configuration = buildProxyConfiguration(url); CloudFoundryClient client = new CloudFoundryClient(cloudCredentials, url, configuration, true); if (printStream != null) { printStream.println(getMessageWithPrefix(USERNAME_PASSWORD_DEPRECATED)); printStream.println(getMessageWithPrefix(LOGIN_IN_SUCCEED)); } return "bearer " + client.login().toString(); }