/** * Return the access key and secret for S3 API use. * or indicated in the UserInfo of the name URI param. * @param name the URI for which we need the access keys; may be null * @param conf the Configuration object to interrogate for keys. * @return AWSAccessKeys * @throws IOException problems retrieving passwords from KMS. */ public static S3xLoginHelper.Login getAWSAccessKeys(URI name, Configuration conf) throws IOException { S3xLoginHelper.rejectSecretsInURIs(name); Configuration c = ProviderUtils.excludeIncompatibleCredentialProviders( conf, S3AFileSystem.class); String bucket = name != null ? name.getHost() : ""; // get the secrets from the configuration // get the access key String accessKey = lookupPassword(bucket, c, ACCESS_KEY); // and the secret String secretKey = lookupPassword(bucket, c, SECRET_KEY); return new S3xLoginHelper.Login(accessKey, secretKey); }