예제 #1
0
        private static void TestStsUtility()
        {
            Console.WriteLine("========================================================");
            Console.WriteLine("| Testing StsUtility                                   |");
            Console.WriteLine("========================================================");
            Console.WriteLine("\n");

            try
            {
                StsUtility  stsUtility  = new StsUtility();
                Credentials credentials = stsUtility.GetSessionToken(AccessKey, SecretKey);

                Console.WriteLine("Temporary Credentials were located ...");
                Console.WriteLine("Session Access Key: " + credentials.AccessKeyId);
                Console.WriteLine("Session Token: " + credentials.SessionToken);
                Console.WriteLine("Session expiration: " + credentials.Expiration);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occured ...");
                Console.WriteLine("Message: " + ex.Message);
                Console.WriteLine("StackTrace:\n" + ex.StackTrace);
            }

            Console.WriteLine();
        }
        public DocumentDbDALC(string key, string secret)
        {
            StsUtility  stsUtility  = new StsUtility();
            Credentials credentials = stsUtility.GetSessionToken(key, secret);

            AccessKey    = credentials.AccessKeyId;
            SecretKey    = credentials.SecretAccessKey;
            SessionToken = credentials.SessionToken;
        }
예제 #3
0
        /// <summary>
        /// Constructor that takes the bucket, key, and secret
        /// </summary>
        /// <param name="bucketName">AWS Bucket name</param>
        /// <param name="key">AWS Key</param>
        /// <param name="secret">AWS Secret</param>
        public DocumentUploadUtility(string bucketName, string key, string secret)
        {
            BucketName = bucketName;

            StsUtility  stsUtility  = new StsUtility();
            Credentials credentials = stsUtility.GetSessionToken(key, secret);

            AccessKey    = credentials.AccessKeyId;
            SecretKey    = credentials.SecretAccessKey;
            SessionToken = credentials.SessionToken;
        }