/** * Constructs a new WebIdentityFederationSessionCredentialsProvider, which will use the * specified 3rd-party web identity provider to make a request to the AWS * Security Token Service (STS) to request short lived session credentials, * which will then be returned by this class's {@link #getCredentials()} * method. * * @param wifToken * The OAuth/OpenID token from the the Identity Provider * @param wifProvider * The name of the Identity Provider (null for OpenID providers) * @param roleArn * The ARN of the IAM Role that will be assumed * @param clientConfiguation * Configuration to apply to STS client created */ public WebIdentityFederationSessionCredentialsProvider(String wifToken, String wifProvider, String roleArn, ClientConfiguration clientConfiguration) { this(wifToken, wifProvider, roleArn, new AWSSecurityTokenServiceClient(new AnonymousAWSCredentials(), clientConfiguration)); }
@Override public AWSCredentials getCredentials() { try { return super.getCredentials(); } catch (AmazonClientException ace) { } LOG.debug("No credentials available; falling back to anonymous access"); return new AnonymousAWSCredentials(); } }
@Override public AWSCredentialsProvider getCredentialsProvider(Map<PropertyDescriptor, String> properties) { AnonymousAWSCredentials creds = new AnonymousAWSCredentials(); return new StaticCredentialsProvider(creds); }
CryptoConfiguration cryptoConfig) { this(new StaticCredentialsProvider(new AnonymousAWSCredentials()), encryptionMaterialsProvider, configFactory.getConfig(), cryptoConfig);
EncryptionMaterialsProvider encryptionMaterialsProvider) { this(new StaticCredentialsProvider(new AnonymousAWSCredentials()), encryptionMaterialsProvider, configFactory.getConfig(), new CryptoConfiguration());
protected AWSCredentials getCredentials(final ProcessContext context) { final String accessKey = context.getProperty(ACCESS_KEY).evaluateAttributeExpressions().getValue(); final String secretKey = context.getProperty(SECRET_KEY).evaluateAttributeExpressions().getValue(); final String credentialsFile = context.getProperty(CREDENTIALS_FILE).getValue(); if (credentialsFile != null) { try { return new PropertiesCredentials(new File(credentialsFile)); } catch (final IOException ioe) { throw new ProcessException("Could not read Credentials File", ioe); } } if (accessKey != null && secretKey != null) { return new BasicAWSCredentials(accessKey, secretKey); } return new AnonymousAWSCredentials(); }
/** * An extension of the AbstractCognitoProvider that is used to communicate * with Cognito. * * @param accountId the account id of the developer * @param identityPoolId the identity pool id of the app/user in question * @param clientConfiguration the configuration to apply to service clients * created */ public AWSEnhancedCognitoIdentityProvider(String accountId, String identityPoolId, ClientConfiguration clientConfiguration) { this(accountId, identityPoolId, new AmazonCognitoIdentityClient (new AnonymousAWSCredentials(), clientConfiguration)); }
/** * An extension of the AbstractCognitoProvider that is used to communicate * with Cognito. * * @param accountId the account id of the developer * @param identityPoolId the identity pool id of the app/user in question * @param clientConfiguration the configuration to apply to service clients * created */ public AWSBasicCognitoIdentityProvider(String accountId, String identityPoolId, ClientConfiguration clientConfiguration) { this(accountId, identityPoolId, new AmazonCognitoIdentityClient (new AnonymousAWSCredentials(), clientConfiguration)); }
/** * Constructs a new WebIdentityFederationSessionCredentialsProvider, which * will use the specified 3rd-party web identity provider to make a request * to the AWS Security Token Service (STS) to request short lived session * credentials, which will then be returned by this class's * {@link #getCredentials()} method. * * @param wifToken The OAuth/OpenID token from the the Identity Provider * @param wifProvider The name of the Identity Provider (null for OpenID * providers) * @param roleArn The ARN of the IAM Role that will be assumed * @param clientConfiguation Configuration to apply to STS client created */ public WebIdentityFederationSessionCredentialsProvider(String wifToken, String wifProvider, String roleArn, ClientConfiguration clientConfiguration) { this(wifToken, wifProvider, roleArn, new AWSSecurityTokenServiceClient( new AnonymousAWSCredentials(), clientConfiguration)); }
private static AmazonCognitoIdentityClient createIdentityClient(ClientConfiguration clientConfiguration, final Regions region) { AmazonCognitoIdentityClient identityClient = new AmazonCognitoIdentityClient(new AnonymousAWSCredentials(), clientConfiguration); identityClient.setRegion(Region.getRegion(region)); return identityClient; }
/** * Wraps around the AbstractIdentityProvider to cover some back end code * that is consistent across all providers, utilizing the CIB client to * handle the identity management. * * @param accountId the account id of the developer * @param identityPoolId the identity pool id of the app/user in question * @param clientConfiguration the configuration to apply to service clients * created * @param region the region the cib client will use */ public AWSAbstractCognitoDeveloperIdentityProvider(String accountId, String identityPoolId, ClientConfiguration clientConfiguration, Regions region) { this(accountId, identityPoolId, new AmazonCognitoIdentityClient (new AnonymousAWSCredentials(), clientConfiguration)); this.cib.setRegion(Region.getRegion(region)); }
@Before public void setup() throws IOException { provider = new StaticCredentialsProvider(new AnonymousAWSCredentials()); recorder = new KinesisRecorder(temp.newFolder(WORKING_DIRECTORY), Regions.US_EAST_1, provider); }
@Before public void setup() throws IOException { AWSCredentialsProvider provider = new StaticCredentialsProvider( new AnonymousAWSCredentials()); recorder = new KinesisFirehoseRecorder(temp.newFolder(), Regions.US_WEST_2, provider); }
private PinpointConfiguration createConfig(String appId) { provider = new StaticCredentialsProvider(new AnonymousAWSCredentials()); return new PinpointConfiguration(new ContextWithPermissions( RuntimeEnvironment.application.getApplicationContext()), appId, Regions.US_EAST_1, ChannelType.GCM, provider); }
/** * Tests that if passed anonymous credentials, signer will not generate a * signature */ @Test public void testAnonymous() throws Exception { final AWSCredentials credentials = new AnonymousAWSCredentials(); final Request<?> request = generateBasicRequest(); final Calendar c = new GregorianCalendar(); c.set(1981, 1, 16, 6, 30, 0); c.setTimeZone(TimeZone.getTimeZone("UTC")); signer.overrideDate(c.getTime()); signer.sign(request, credentials); assertNull(request.getHeaders().get("Authorization")); }
private static void testSignAnonymously(AmazonS3Client s3) { final Request<?> fakeGetObjectRequest = createFakeGetObjectRequest(s3); final Signer signer = s3.createSigner(fakeGetObjectRequest, FAKE_BUCKET, FAKE_KEY); signer.sign(fakeGetObjectRequest, new AnonymousAWSCredentials()); } }
/** * Sets up the clients, and also tests the creation callback functionality. */ @Before public void setup() { provider = new StaticCredentialsProvider(new AnonymousAWSCredentials()); AnalyticsConfig options = new AnalyticsConfig(); options.withAllowsWANDelivery(true); analyticsClient = MobileAnalyticsManager.getOrCreateInstance(new ContextWithPermissions( new Activity().getApplicationContext()), uniqueAnalyticsTag1 + (new Random()).nextInt(), Regions.US_EAST_1, provider, options); }
@Test public void testAnonymous() throws Exception { Request<?> request = new DefaultRequest<Void>(null, "foo"); request.setEndpoint(URI.create("http://foo.amazon.com/foo")); request.addParameter("foo", "bar"); request.setResourcePath("bar"); signer.sign(request, new AnonymousAWSCredentials()); assertNull(request.getParameters().get("Signature")); }
@Test public void testPresigners2() throws Exception { final AWSCredentials credentials = new AnonymousAWSCredentials(); final Request<?> request = generateBasicRequest(); final Calendar c = new GregorianCalendar(); c.set(1981, 1, 16, 6, 30, 0); c.setTimeZone(TimeZone.getTimeZone("UTC")); signer.overrideDate(c.getTime()); signer.setServiceName("demo"); signer.presignRequest(request, credentials, null); assertNull(request.getParameters().get("X-Amz-Credential")); assertNull(request.getParameters().get("X-Amz-Date")); assertNull(request.getParameters().get("X-Amz-Expires")); assertNull(request.getParameters().get("X-Amz-Security-Token")); }
@Test public void testSetCredentials() { AmazonWebServiceRequest awsr = new TestRequest(); AWSCredentials creds = new AnonymousAWSCredentials(); awsr.setRequestCredentials(creds); assertSame(awsr.getRequestCredentials(), creds); }