AWSCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey); try { S3Service s3Service = new RestS3Service(awsCredentials);
Preconditions.checkArgument(conf.isSet(PropertyKey.GCS_SECRET_KEY), "Property " + PropertyKey.GCS_SECRET_KEY + " is required to connect to GCS"); GSCredentials googleCredentials = new GSCredentials( conf.get(PropertyKey.GCS_ACCESS_KEY), conf.get(PropertyKey.GCS_SECRET_KEY));
public static ProviderCredentials load(String password, File file) throws ServiceException { ProviderCredentials credentials = ProviderCredentials.load(password, file); return new GSCredentials( credentials.getAccessKey(), credentials.getSecretKey(), credentials.getFriendlyName()); }
/** * Fetch IAM role credentials from EC2 instance data and re-populate * this object. */ public void refreshFromEC2InstanceData() { AWSEC2IAMSessionCredentials loadedCredentials = AWSEC2IAMSessionCredentials.loadFromEC2InstanceData( this.roleName, this.automaticRefreshEnabled); this.accessKey = loadedCredentials.getAccessKey(); this.secretKey = loadedCredentials.getSecretKey(); this.sessionToken = loadedCredentials.getSessionToken(); this.expiration = loadedCredentials.getExpiration(); }
/** * @return * a string summarizing these credentials */ @Override public String getLogString() { return super.getLogString() + " : " + getUserToken() + " : " + getProductToken(); }
/** * @return * the string of data that needs to be encrypted (for serialization) */ @Override protected String getDataToEncrypt() { return getAccessKey() + V3_KEYS_DELIMITER + getSecretKey() + V3_KEYS_DELIMITER + getUserToken() + V3_KEYS_DELIMITER + getProductToken(); } }
public OAuth2Tokens getOAuth2Tokens() throws IOException { if(null == this.oauth2Tokens) { return null; } if (this.oauth2Tokens.isAccessTokenExpired()) { this.oauth2Tokens = this.refreshOAuth2Tokens(); } return this.oauth2Tokens; }
/** * @return * the Secret Key. */ @Override public String getSecretKey() { refreshFromEC2InstanceDataIfNearExpiration(); return secretKey; }
/** * @return the OAuth2 Client ID (stored as access key) */ public String getClientId() { return this.getAccessKey(); }
/** * @return the OAuth2 Client Secret (stored as secret key) */ public String getClientSecret() { return this.getSecretKey(); }
public static ProviderCredentials load(String password, BufferedInputStream inputStream) throws ServiceException { ProviderCredentials credentials = ProviderCredentials.load(password, inputStream); return new GSCredentials( credentials.getAccessKey(), credentials.getSecretKey(), credentials.getFriendlyName()); }
/** * @return * a string summarizing these credentials */ @Override public String getLogString() { return super.getLogString() + " : " + getUserToken() + " : " + getProductToken(); }
public OAuth2Tokens getOAuth2Tokens() throws IOException { if(null == this.oauth2Tokens) { return null; } if (this.oauth2Tokens.isAccessTokenExpired()) { this.oauth2Tokens = this.refreshOAuth2Tokens(); } return this.oauth2Tokens; }
/** * @return * expiration date of session token. */ public Date getExpiration() { refreshFromEC2InstanceDataIfNearExpiration(); return expiration; }
public static ProviderCredentials load(String password, File file) throws ServiceException { ProviderCredentials credentials = ProviderCredentials.load(password, file); return new GSCredentials( credentials.getAccessKey(), credentials.getSecretKey(), credentials.getFriendlyName()); }
/** * @return * The AWS session token for temporary/session-based account credentials. */ @Override public String getSessionToken() { refreshFromEC2InstanceDataIfNearExpiration(); return this.sessionToken; }
public static ProviderCredentials load(String password, BufferedInputStream inputStream) throws ServiceException { ProviderCredentials credentials = ProviderCredentials.load(password, inputStream); return new GSCredentials( credentials.getAccessKey(), credentials.getSecretKey(), credentials.getFriendlyName()); }
/** * @return * the Secret Key. */ @Override public String getSecretKey() { refreshFromEC2InstanceDataIfNearExpiration(); return secretKey; }
/** * @return * expiration date of session token. */ public Date getExpiration() { refreshFromEC2InstanceDataIfNearExpiration(); return expiration; }
/** * @return * The AWS session token for temporary/session-based account credentials. */ @Override public String getSessionToken() { refreshFromEC2InstanceDataIfNearExpiration(); return this.sessionToken; }