Exemple #1
0
        /// <summary>
        /// 构建Authorization头信息
        /// </summary>
        /// <param name="builder">请求参数封装信息</param>
        /// <param name="signature">签名信息</param>
        /// <param name="credentials">证书信息</param>
        /// <param name="signerParams">签名参数信息</param>
        /// <returns>http头 Authorization 信息字符串</returns>
        private string BuildAuthorizationHeader(SdkHttpFullRequestBuilder builder, byte[] signature, ICredentials credentials,
                                                SignerRequestParams signerParams)
        {
            string signingCredentials = credentials.AccessKeyId() + "/" + signerParams.Scope;
            string credential         = "Credential=" + signingCredentials;
            string signerHeaders      = "SignedHeaders=" + GetSignedHeadersString(builder);
            string signatureHeader    = "Signature=" + StringUtils.ByteToHex(signature, true);

            return(new StringBuilder().Append(ParameterConstant.JDCLOUD2_SIGNING_ALGORITHM)
                   .Append(" ")
                   .Append(credential)
                   .Append(", ")
                   .Append(signerHeaders)
                   .Append(", ")
                   .Append(signatureHeader)
                   .ToString());
        }