usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject git commit: validating credentials
Date Fri, 03 Oct 2014 19:43:38 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/sqs_queues 2570c800f -> 749bbedf9


validating credentials


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/749bbedf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/749bbedf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/749bbedf

Branch: refs/heads/sqs_queues
Commit: 749bbedf95b6f87ccbc36d7932d6357d8eb133b4
Parents: 2570c80
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Fri Oct 3 13:43:25 2014 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Fri Oct 3 13:43:25 2014 -0600

----------------------------------------------------------------------
 .../core/util/UsergridAwsCredentialsProvider.java           | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/749bbedf/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/util/UsergridAwsCredentialsProvider.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/util/UsergridAwsCredentialsProvider.java
b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/util/UsergridAwsCredentialsProvider.java
index 6792bde..e8608c7 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/util/UsergridAwsCredentialsProvider.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/util/UsergridAwsCredentialsProvider.java
@@ -17,9 +17,11 @@
  */
 package org.apache.usergrid.persistence.core.util;
 
+import com.amazonaws.AmazonClientException;
 import com.amazonaws.SDKGlobalConfiguration;
 import com.amazonaws.auth.AWSCredentials;
 import com.amazonaws.auth.AWSCredentialsProvider;
+import org.apache.commons.lang.StringUtils;
 
 
 public class UsergridAwsCredentialsProvider implements AWSCredentialsProvider {
@@ -34,14 +36,17 @@ public class UsergridAwsCredentialsProvider implements AWSCredentialsProvider
{
         creds = new AWSCredentials() {
             @Override
             public String getAWSAccessKeyId() {
-                return System.getProperty(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
+                return StringUtils.trim(System.getProperty(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR));
             }
 
             @Override
             public String getAWSSecretKey() {
-                return System.getProperty(SDKGlobalConfiguration.SECRET_KEY_ENV_VAR);
+                return StringUtils.trim(System.getProperty(SDKGlobalConfiguration.SECRET_KEY_ENV_VAR));
             }
         };
+        if(StringUtils.isEmpty(creds.getAWSAccessKeyId()) || StringUtils.isEmpty(creds.getAWSSecretKey())
){
+            throw new AmazonClientException("could not retrieve credentials from system properties");
+        }
     }
 
     @Override


Mime
View raw message