private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); } }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); }
/** * Returns the AWS credentials for the specified profile. */ public AWSCredentials getCredentials(String profileName) { final AWSCredentialsProvider provider = credentialProviderCache.get(profileName); if (provider != null) { return provider.getCredentials(); } else { BasicProfile profile = allProfiles.getProfile(profileName); if (profile == null) { throw new IllegalArgumentException("No AWS profile named '" + profileName + "'"); } final AWSCredentialsProvider newProvider = fromProfile(profile); credentialProviderCache.put(profileName, newProvider); return newProvider.getCredentials(); } }
private AWSCredentialsProvider fromAssumeRole() { if (StringUtils.isNullOrEmpty(profile.getRoleSourceProfile())) { throw new SdkClientException(String.format( "Unable to load credentials from profile [%s]: Source profile name is not specified", profile.getProfileName())); } final BasicProfile sourceProfile = allProfiles .getProfile(this.profile.getRoleSourceProfile()); if (sourceProfile == null) { throw new SdkClientException(String.format( "Unable to load source profile [%s]: Source profile was not found [%s]", profile.getProfileName(), profile.getRoleSourceProfile())); } AWSCredentials sourceCredentials = new ProfileStaticCredentialsProvider(sourceProfile) .getCredentials(); final String roleSessionName = (this.profile.getRoleSessionName() == null) ? "aws-sdk-java-" + System.currentTimeMillis() : this.profile.getRoleSessionName(); RoleInfo roleInfo = new RoleInfo().withRoleArn(this.profile.getRoleArn()) .withRoleSessionName(roleSessionName) .withExternalId(this.profile.getRoleExternalId()) .withLongLivedCredentials(sourceCredentials); return profileCredentialsService.getAssumeRoleCredentialsProvider(roleInfo); } }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); } }
/** * Returns the AWS credentials for the specified profile. */ public AWSCredentials getCredentials(String profileName) { final AWSCredentialsProvider provider = credentialProviderCache.get(profileName); if (provider != null) { return provider.getCredentials(); } else { BasicProfile profile = allProfiles.getProfile(profileName); if (profile == null) { throw new IllegalArgumentException("No AWS profile named '" + profileName + "'"); } final AWSCredentialsProvider newProvider = fromProfile(profile); credentialProviderCache.put(profileName, newProvider); return newProvider.getCredentials(); } }
private AWSCredentialsProvider fromAssumeRole() { if (StringUtils.isNullOrEmpty(profile.getRoleSourceProfile())) { throw new SdkClientException(String.format( "Unable to load credentials from profile [%s]: Source profile name is not specified", profile.getProfileName())); } final BasicProfile sourceProfile = allProfiles .getProfile(this.profile.getRoleSourceProfile()); if (sourceProfile == null) { throw new SdkClientException(String.format( "Unable to load source profile [%s]: Source profile was not found [%s]", profile.getProfileName(), profile.getRoleSourceProfile())); } AWSCredentials sourceCredentials = new ProfileStaticCredentialsProvider(sourceProfile) .getCredentials(); final String roleSessionName = (this.profile.getRoleSessionName() == null) ? "aws-sdk-java-" + System.currentTimeMillis() : this.profile.getRoleSessionName(); RoleInfo roleInfo = new RoleInfo().withRoleArn(this.profile.getRoleArn()) .withRoleSessionName(roleSessionName) .withExternalId(this.profile.getRoleExternalId()) .withLongLivedCredentials(sourceCredentials); return profileCredentialsService.getAssumeRoleCredentialsProvider(roleInfo); } }
private BasicProfile loadProfile(File configFile) { final AllProfiles allProfiles = profileConfigLoader.loadProfiles(configFile); return allProfiles.getProfile(profileName); }
/** * Returns the AWS credentials for the specified profile. */ public AWSCredentials getCredentials(String profileName) { final AWSCredentialsProvider provider = credentialProviderCache.get(profileName); if (provider != null) { return provider.getCredentials(); } else { BasicProfile profile = allProfiles.getProfile(profileName); if (profile == null) { throw new IllegalArgumentException("No AWS profile named '" + profileName + "'"); } final AWSCredentialsProvider newProvider = fromProfile(profile); credentialProviderCache.put(profileName, newProvider); return newProvider.getCredentials(); } }
private AWSCredentialsProvider fromAssumeRole() { if (StringUtils.isNullOrEmpty(profile.getRoleSourceProfile())) { throw new SdkClientException(String.format( "Unable to load credentials from profile [%s]: Source profile name is not specified", profile.getProfileName())); } final BasicProfile sourceProfile = allProfiles .getProfile(this.profile.getRoleSourceProfile()); if (sourceProfile == null) { throw new SdkClientException(String.format( "Unable to load source profile [%s]: Source profile was not found [%s]", profile.getProfileName(), profile.getRoleSourceProfile())); } AWSCredentials sourceCredentials = new ProfileStaticCredentialsProvider(sourceProfile) .getCredentials(); final String roleSessionName = (this.profile.getRoleSessionName() == null) ? "aws-sdk-java-" + System.currentTimeMillis() : this.profile.getRoleSessionName(); RoleInfo roleInfo = new RoleInfo().withRoleArn(this.profile.getRoleArn()) .withRoleSessionName(roleSessionName) .withExternalId(this.profile.getRoleExternalId()) .withLongLivedCredentials(sourceCredentials); return profileCredentialsService.getAssumeRoleCredentialsProvider(roleInfo); } }