You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/06/09 07:51:19 UTC
incubator-ignite git commit: ignite-1000: authentication with json key
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-1000 bbbcf0b88 -> f35f418be
ignite-1000: authentication with json key
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f35f418b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f35f418b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f35f418b
Branch: refs/heads/ignite-1000
Commit: f35f418be4b2bbaa06217c32797807ca5c473a9a
Parents: bbbcf0b
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Jun 9 08:51:10 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Jun 9 08:51:10 2015 +0300
----------------------------------------------------------------------
.../ipfinder/cloud/TcpDiscoveryCloudIpFinder.java | 17 ++++++++---------
.../cloud/TcpDiscoveryCloudIpFinderSelfTest.java | 12 ++++++------
2 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f35f418b/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
----------------------------------------------------------------------
diff --git a/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java b/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
index ff210e5..97e8bfa 100644
--- a/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
+++ b/modules/cloud/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinder.java
@@ -99,7 +99,7 @@ import java.util.concurrent.atomic.*;
* <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.cloud.TcpDiscoveryCloudIpFinder"/>
* <property name="provider" value="google-compute-engine"/>
* <property name="identity" value="your_service_account_email"/>
- * <property name="credentialPath" value="path_to_pem_file"/>
+ * <property name="credentialPath" value="path_to_json_key"/>
* <property name="zones">
* <list>
* <value>us-central1-a</value>
@@ -255,8 +255,7 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
/**
* Sets the path to a credential that is used during authentication on the cloud.
*
- * This method should be used when an access key or private key is stored in a plain or PEM file without
- * a passphrase.
+ * This method should be used when an access key or private key is stored in a file.
* Content of the file, referred by @{code credentialPath}, is fully read and used as a access key or private key
* during authentication.
*
@@ -407,15 +406,15 @@ public class TcpDiscoveryCloudIpFinder extends TcpDiscoveryIpFinderAdapter {
*/
private String getCredentialFromFile() throws IgniteSpiException {
try {
- if (!provider.equals("google-compute-engine"))
- throw new IgniteSpiException("Failed to read credentials from file, unsupported provider [" +
- "provider=" + provider + ", credentialPath=" + credentialPath + ']');
-
String fileContents = Files.toString(new File(credentialPath), Charsets.UTF_8);
- Supplier<Credentials> credentialSupplier = new GoogleCredentialsFromJson(fileContents);
+ if (provider.equals("google-compute-engine")) {
+ Supplier<Credentials> credentialSupplier = new GoogleCredentialsFromJson(fileContents);
+
+ return credentialSupplier.get().credential;
+ }
- return credentialSupplier.get().credential;
+ return fileContents;
}
catch (IOException e) {
throw new IgniteSpiException("Failed to retrieve the private key from the file: " + credentialPath, e);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f35f418b/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java b/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
index 618189d..d1d945f 100644
--- a/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
+++ b/modules/cloud/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/cloud/TcpDiscoveryCloudIpFinderSelfTest.java
@@ -59,9 +59,9 @@ public class TcpDiscoveryCloudIpFinderSelfTest extends
*
* @throws Exception If any error occurs.
*/
- //public void testAmazonWebServices() throws Exception {
- // testCloudProvider("aws-ec2");
- //}
+ public void testAmazonWebServices() throws Exception {
+ testCloudProvider("aws-ec2");
+ }
/**
* Tests GCE.
@@ -77,9 +77,9 @@ public class TcpDiscoveryCloudIpFinderSelfTest extends
*
* @throws Exception If any error occurs.
*/
- //public void testRackspace() throws Exception {
- // testCloudProvider("rackspace-cloudservers-us");
- //}
+ public void testRackspace() throws Exception {
+ testCloudProvider("rackspace-cloudservers-us");
+ }
/**
* Tests a given provider.