public TelemetricsClient(IAmazonCognitoIdentity cognitoIdentityClient, IParameterStore parameterStore)
 {
     _cognitoIdentityClient = cognitoIdentityClient;
     _parameterStore        = parameterStore;
     _clientId   = parameterStore.GetParameter(CLIENT_ID);
     _httpClient = new HttpClient();
 }
        /// <summary>
        /// Constructs a new CognitoAWSCredentials instance, which will use the
        /// specified Amazon Cognito identity pool to make a requests to the
        /// AWS Security Token Service (STS) to request short lived session credentials.
        /// </summary>
        /// <param name="accountId">The AWS accountId for the account with Amazon Cognito</param>
        /// <param name="identityPoolId">The Amazon Cogntio identity pool to use</param>
        /// <param name="unAuthRoleArn">The ARN of the IAM Role that will be assumed when unauthenticated</param>
        /// <param name="authRoleArn">The ARN of the IAM Role that will be assumed when authenticated</param>
        /// <param name="cibClient">Preconfigured Cognito Identity client to make requests with</param>
        /// <param name="stsClient">>Preconfigured STS client to make requests with</param>
        public CognitoAWSCredentials(
            string accountId, string identityPoolId,
            string unAuthRoleArn, string authRoleArn,
            IAmazonCognitoIdentity cibClient, IAmazonSecurityTokenService stsClient)
        {
            if (string.IsNullOrEmpty(identityPoolId))
            {
                throw new ArgumentNullException("identityPoolId");
            }
            if (cibClient == null)
            {
                throw new ArgumentNullException("cibClient");
            }
            if ((unAuthRoleArn != null || authRoleArn != null) && stsClient == null)
            {
                throw new ArgumentNullException("stsClient");
            }

            AccountId      = accountId;
            IdentityPoolId = identityPoolId;
            UnAuthRoleArn  = unAuthRoleArn;
            AuthRoleArn    = authRoleArn;
            Logins         = new Dictionary <string, string>(StringComparer.Ordinal);
            cib            = cibClient;
            sts            = stsClient;
            //check cache for identity id
            string cachedIdentity = GetCachedIdentityId();

            if (!string.IsNullOrEmpty(cachedIdentity))
            {
                UpdateIdentity(cachedIdentity);
                //update the credentials from cache
                currentState = GetCachedCredentials();
            }
        }
        /// <summary>
        /// Constructs a new CognitoAWSCredentials instance, which will use the
        /// specified Amazon Cognito identity pool to make a requests to the
        /// AWS Security Token Service (STS) to request short lived session credentials.
        /// </summary>
        /// <param name="accountId">The AWS accountId for the account with Amazon Cognito</param>
        /// <param name="identityPoolId">The Amazon Cogntio identity pool to use</param>
        /// <param name="unAuthRoleArn">The ARN of the IAM Role that will be assumed when unauthenticated</param>
        /// <param name="authRoleArn">The ARN of the IAM Role that will be assumed when authenticated</param>
        /// <param name="cibClient">Preconfigured Cognito Identity client to make requests with</param>
        /// <param name="stsClient">>Preconfigured STS client to make requests with</param>
        public CognitoAWSCredentials(
            string accountId, string identityPoolId,
            string unAuthRoleArn, string authRoleArn,
            IAmazonCognitoIdentity cibClient, IAmazonSecurityTokenService stsClient)
        {
            if (string.IsNullOrEmpty(identityPoolId))
            {
                throw new ArgumentNullException("identityPoolId");
            }
            if (cibClient == null)
            {
                throw new ArgumentNullException("cibClient");
            }
            if (stsClient == null)
            {
                throw new ArgumentNullException("stsClient");
            }

            AccountId      = accountId;
            IdentityPoolId = identityPoolId;
            UnAuthRoleArn  = unAuthRoleArn;
            AuthRoleArn    = authRoleArn;
            Logins         = new Dictionary <string, string>(StringComparer.Ordinal);
            cib            = cibClient;
            sts            = stsClient;
        }
        /// <summary>
        /// Constructs a new CognitoAWSCredentials instance, which will use the
        /// specified Amazon Cognito identity pool to make a requests to the
        /// AWS Security Token Service (STS) to request short lived session credentials.
        /// </summary>
        /// <param name="accountId">The AWS accountId for the account with Amazon Cognito</param>
        /// <param name="identityPoolId">The Amazon Cogntio identity pool to use</param>
        /// <param name="unAuthRoleArn">The ARN of the IAM Role that will be assumed when unauthenticated</param>
        /// <param name="authRoleArn">The ARN of the IAM Role that will be assumed when authenticated</param>
        /// <param name="cibClient">Preconfigured Cognito Identity client to make requests with</param>
        /// <param name="stsClient">>Preconfigured STS client to make requests with</param>
        public CognitoAWSCredentials(
            string accountId, string identityPoolId,
            string unAuthRoleArn, string authRoleArn,
            IAmazonCognitoIdentity cibClient, IAmazonSecurityTokenService stsClient)
        {
            if (string.IsNullOrEmpty(identityPoolId)) throw new ArgumentNullException("identityPoolId");
            if (cibClient == null) throw new ArgumentNullException("cibClient");
            if (stsClient == null) throw new ArgumentNullException("stsClient");

            AccountId = accountId;
            IdentityPoolId = identityPoolId;
            UnAuthRoleArn = unAuthRoleArn;
            AuthRoleArn = authRoleArn;
            Logins = new Dictionary<string, string>(StringComparer.Ordinal);
            cib = cibClient;
            sts = stsClient;
        }
Example #5
0
 private Amazon.CognitoIdentity.Model.TagResourceResponse CallAWSServiceOperation(IAmazonCognitoIdentity client, Amazon.CognitoIdentity.Model.TagResourceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cognito Identity", "TagResource");
     try
     {
         #if DESKTOP
         return(client.TagResource(request));
         #elif CORECLR
         return(client.TagResourceAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
Example #6
0
 internal ListIdentityPoolsPaginator(IAmazonCognitoIdentity client, ListIdentityPoolsRequest request)
 {
     this._client  = client;
     this._request = request;
 }
Example #7
0
 internal CognitoIdentityPaginatorFactory(IAmazonCognitoIdentity client)
 {
     this.client = client;
 }
 /// <summary>
 /// Constructs a new SQLiteCognitoAWSCredentials instance, which will use the
 /// specified Amazon Cognito identity pool to make a requests to the
 /// AWS Security Token Service (STS) to request short lived session credentials.
 /// </summary>
 /// <param name="accountId">The AWS accountId for the account with Amazon Cognito</param>
 /// <param name="identityPoolId">The Amazon Cogntio identity pool to use</param>
 /// <param name="unAuthRoleArn">The ARN of the IAM Role that will be assumed when unauthenticated</param>
 /// <param name="authRoleArn">The ARN of the IAM Role that will be assumed when authenticated</param>
 /// <param name="cibClient">Preconfigured Cognito Identity client to make requests with</param>
 /// <param name="stsClient">>Preconfigured STS client to make requests with</param>
 public SQLiteCognitoAWSCredentials(string accountId, string identityPoolId, string unAuthRoleArn, string authRoleArn, IAmazonCognitoIdentity cibClient, IAmazonSecurityTokenService stsClient)
     : base(accountId, identityPoolId, unAuthRoleArn, authRoleArn, cibClient, stsClient) { }
        /// <summary>
        /// Constructs a new CognitoAWSCredentials instance, which will use the
        /// specified Amazon Cognito identity pool to make a requests to the
        /// AWS Security Token Service (STS) to request short lived session credentials.
        /// </summary>
        /// <param name="accountId">The AWS accountId for the account with Amazon Cognito</param>
        /// <param name="identityPoolId">The Amazon Cogntio identity pool to use</param>
        /// <param name="unAuthRoleArn">The ARN of the IAM Role that will be assumed when unauthenticated</param>
        /// <param name="authRoleArn">The ARN of the IAM Role that will be assumed when authenticated</param>
        /// <param name="cibClient">Preconfigured Cognito Identity client to make requests with</param>
        /// <param name="stsClient">>Preconfigured STS client to make requests with</param>
        public CognitoAWSCredentials(
            string accountId, string identityPoolId,
            string unAuthRoleArn, string authRoleArn,
            IAmazonCognitoIdentity cibClient, IAmazonSecurityTokenService stsClient)
        {
            if (string.IsNullOrEmpty(identityPoolId)) throw new ArgumentNullException("identityPoolId");
            if (cibClient == null) throw new ArgumentNullException("cibClient");
            if ((unAuthRoleArn != null || authRoleArn != null) && stsClient == null) throw new ArgumentNullException("stsClient");

            AccountId = accountId;
            IdentityPoolId = identityPoolId;
            UnAuthRoleArn = unAuthRoleArn;
            AuthRoleArn = authRoleArn;
            Logins = new Dictionary<string, string>(StringComparer.Ordinal);
            cib = cibClient;
            sts = stsClient;

            //check cache for identity id
            string cachedIdentity = GetCachedIdentityId();

            if (!string.IsNullOrEmpty(cachedIdentity))
            {
                UpdateIdentity(cachedIdentity);
                //update the credentials from cache
                _currentState = GetCachedCredentials();
            }

        }
Example #10
0
 public DotnetCognitoAWSCredentials(string accountId, string identityPoolId, string unAuthRoleArn, string authRoleArn, IAmazonCognitoIdentity cibClient, IAmazonSecurityTokenService stsClient) : base(accountId, identityPoolId, unAuthRoleArn, authRoleArn, cibClient, stsClient)
 {
 }
Example #11
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Client = CreateClient(_CurrentCredentials, _RegionEndpoint);
        }
Example #12
0
 public TelemetricsClient(IAmazonCognitoIdentity cognitoIdentityClient)
 {
     _cognitoIdentityClient = cognitoIdentityClient;
     _httpClient            = new HttpClient();
 }