/** * 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)); }
/** * Sets up an AWSAbstractCognitoIdentityProvider, which will serve as the * baseline for both Cognito and developer trusted identity providers. * Custom providers should not extend this class, but should extend * AWSAbstractCognitoDeveloperIdentityProvider * * @deprecated please use AWSAbstractCognitoIdentityProvider(String * accountId, String identityPoolId, ClientConfiguration * clientConfiguration, Regions region) instead. * @param accountId the accountId of the developer * @param identityPoolId the identityPoolId to be used * @param clientConfiguration the client configuration to be used by the * client */ @Deprecated public AWSAbstractCognitoIdentityProvider(String accountId, String identityPoolId, ClientConfiguration clientConfiguration) { this(accountId, identityPoolId, new AmazonCognitoIdentityClient (new AnonymousAWSCredentials(), clientConfiguration)); }
/** * 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. * * @deprecated please use AWSAbstractCognitoDeveloperIdentityProvider(String * accountId, String identityPoolId, ClientConfiguration * clientConfiguration, Regions region) instead * @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 */ @Deprecated public AWSAbstractCognitoDeveloperIdentityProvider(String accountId, String identityPoolId, ClientConfiguration clientConfiguration) { this(accountId, identityPoolId, new AmazonCognitoIdentityClient (new AnonymousAWSCredentials(), clientConfiguration)); }
/** * Constructs a new CognitoCredentialsProvider, which will set up a link to * the provider passed in using the basic authentication flow to get get * short-lived credentials from STS, which can be retrieved from * {@link #getCredentials()} * <p> * This version of the constructor allows you to specify your own Identity * Provider class. * </p> * * @param provider a reference to the provider in question, including what's * needed to interact with it to later connect with STS * @param unauthArn the unauthArn, for use with the STS call * @param authArn the authArn, for use with the STS call */ public CognitoCredentialsProvider(AWSCognitoIdentityProvider provider, String unauthArn, String authArn) { this(provider, unauthArn, authArn, new AWSSecurityTokenServiceClient( new AnonymousAWSCredentials(), new ClientConfiguration())); }
private static AmazonCognitoIdentityClient createIdentityClient(ClientConfiguration clientConfiguration, final Regions region) { AmazonCognitoIdentityClient identityClient = new AmazonCognitoIdentityClient(new AnonymousAWSCredentials(), clientConfiguration); identityClient.setRegion(Region.getRegion(region)); return identityClient; }
/** * Constructs a new {@link CognitoCredentialsProvider}, which will use the * specified Amazon Cognito identity pool to make a request, using the basic * authentication flow, 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. * <p> * This version of the constructor allows you to specify a client * configuration for the Amazon Cognito and STS clients. * </p> * * @param accountId The AWS accountId for the account with Amazon Cognito * @param identityPoolId The Amazon Cognito identity pool to use * @param unauthRoleArn The ARN of the IAM Role that will be assumed when * unauthenticated * @param authRoleArn The ARN of the IAM Role that will be assumed when * authenticated * @param region The region to use when contacting Cognito Identity * @param clientConfiguration Configuration to apply to service clients * created */ public CognitoCredentialsProvider(String accountId, String identityPoolId, String unauthRoleArn, String authRoleArn, Regions region, ClientConfiguration clientConfiguration) { this(accountId, identityPoolId, unauthRoleArn, authRoleArn, createIdentityClient(clientConfiguration, region), (unauthRoleArn == null && authRoleArn == null) ? null : new AWSSecurityTokenServiceClient(new AnonymousAWSCredentials(), clientConfiguration)); }
/** * 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)); }
/** * Sets up an AWSAbstractCognitoIdentityProvider, which will serve as the * baseline for both Cognito and developer trusted identity providers. * Custom providers should not extend this class, but should extend * AWSAbstractCognitoDeveloperIdentityProvider * * @param accountId the accountId of the developer * @param identityPoolId the identityPoolId to be used * @param clientConfiguration the client configuration to be used by the * client * @param region the region cognito will use */ public AWSAbstractCognitoIdentityProvider(String accountId, String identityPoolId, ClientConfiguration clientConfiguration, Regions region) { this(accountId, identityPoolId, new AmazonCognitoIdentityClient (new AnonymousAWSCredentials(), clientConfiguration)); this.cib.setRegion(Region.getRegion(region)); }
/** * Constructs a user-pool with integrated Pinpoint analytics. * * @param context REQUIRED: Android application context. * @param userPoolId REQUIRED: User-pool-Id of the user-pool. * @param clientId REQUIRED: Client-Id generated for this app and user-pool at the * Cognito Identity Provider developer console. * @param clientSecret REQUIRED: Client Secret generated for this app and user-pool at * the Cognito Identity Provider developer console. * @param clientConfiguration REQUIRED: The client configuration options controlling how this * client connects to Cognito Identity Provider Service (e.g. proxy settings, * retry counts, etc.). * @param region REQUIRED: AWS region {@link Regions}. * @param pinpointAppId REQUIRED: AWS Pinpoint App Id for analytics. */ public CognitoUserPool(Context context, String userPoolId, String clientId, String clientSecret, ClientConfiguration clientConfiguration, Regions region, String pinpointAppId) { this.context = context; this.userPoolId = userPoolId; this.clientId = clientId; this.clientSecret = clientSecret; this.client = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), clientConfiguration); this.client.setRegion(com.amazonaws.regions.Region.getRegion(region)); this.pinpointEndpointId = CognitoPinpointSharedContext.getPinpointEndpoint(context, pinpointAppId); }
/** * Constructs a user-pool with default {@link ClientConfiguration}. * * @param context REQUIRED: Android application context. * @param awsConfiguration REQUIRED: Holds the configuration read from awsconfiguration.json */ public CognitoUserPool(Context context, AWSConfiguration awsConfiguration) { try { final JSONObject userPoolConfiguration = awsConfiguration.optJsonObject("CognitoUserPool"); this.context = context; this.userPoolId = userPoolConfiguration.getString("PoolId"); this.clientId = userPoolConfiguration.getString("AppClientId"); this.clientSecret = userPoolConfiguration.optString("AppClientSecret"); this.pinpointEndpointId = CognitoPinpointSharedContext.getPinpointEndpoint(context, userPoolConfiguration.optString("PinpointAppId")); final ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setUserAgent(awsConfiguration.getUserAgent()); this.client = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), clientConfig); this.client.setRegion(com.amazonaws.regions.Region.getRegion(Regions.fromName(userPoolConfiguration.getString("Region")))); } catch (Exception e) { throw new IllegalArgumentException("Failed to read PoolId, AppClientId, " + "AppClientSecret, or Region from AWSConfiguration please check your setup " + "or awsconfiguration.json file", e); } }
@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); }