Exemplo n.º 1
0
        public AwsCredentials get_credentials()
        {
            AwsCredentials creds = this.get_credentials_impl();

            if (!verify_credentials_format(creds))
            {
                throw new Exception("Credentials did not match expected patterns");
            }

            return(creds);
        }
Exemplo n.º 2
0
        public void sign()
        {
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign1");
            AwsCredentials credentials = this.sig_v4_ctx.Credentials_provider().get_credentials();

            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign2");
            this.akid = credentials.Akid();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign3");
            this.secret_key = credentials.Secret_key();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign4");
            if (string.IsNullOrEmpty(credentials.Session_token()))
            {
                this.req.headers().Add("x-amz-security-token", credentials.Session_token());
            }
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign5");
            this.req.headers().Remove("authorization");
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign6");
            this.calculate_canon_query_args();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign7");
            this.calculate_headers();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign8");
            this.calculate_canon_headers();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign9");
            this.calculate_signed_headers();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign10");
            this.calculate_credential_scope();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign11");
            this.calculate_canon_request();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign12");
            this.calculate_str_to_sign();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign13");
            this.calculate_auth_header();
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign14");
            this.req.headers().Add("Authorization", this.auth_header);
            StdErrorOut.Instance.StdOut(LogLevel.debug, "sign15");
        }
Exemplo n.º 3
0
 bool verify_credentials_format(AwsCredentials creds)
 {
     return(kAkidRegex.Match(creds.Akid()).Success&& kSkRegex.Match(creds.Secret_key()).Success);
 }
Exemplo n.º 4
0
 public BasicAwsCredentialsProvider(string akid, string secret_key, string session_token = "")
 {
     creds = new AwsCredentials(akid, secret_key, session_token);
 }