예제 #1
0
            public string Sign(RequestTemplate requestTemplate, Options options, IBlobSigner blobSigner, IClock clock)
            {
                var state     = new SigningState(requestTemplate, options, blobSigner, clock);
                var signature = blobSigner.CreateSignature(state._blobToSign);

                return(state.GetResult(signature));
            }
예제 #2
0
            public async Task <string> SignAsync(
                RequestTemplate requestTemplate, Options options, IBlobSigner blobSigner, IClock clock, CancellationToken cancellationToken)
            {
                var state     = new SigningState(requestTemplate, options, blobSigner, clock);
                var signature = await blobSigner.CreateSignatureAsync(state._blobToSign, cancellationToken).ConfigureAwait(false);

                return(state.GetResult(signature));
            }
            // Note: It's irritating to have to convert from base64 to bytes and then to hex, but we can't change the IBlobSigner implementation
            // and ServiceAccountCredential.CreateSignature returns base64 anyway.

            public string Sign(RequestTemplate requestTemplate, Options options, IBlobSigner blobSigner, IClock clock)
            {
                var state           = new SigningState(requestTemplate, options, blobSigner, clock);
                var base64Signature = blobSigner.CreateSignature(state._blobToSign);
                var rawSignature    = Convert.FromBase64String(base64Signature);
                var hexSignature    = FormatHex(rawSignature);

                return(state.GetResult(hexSignature));
            }
            public async Task <string> SignAsync(
                RequestTemplate requestTemplate, Options options, IBlobSigner blobSigner, IClock clock, CancellationToken cancellationToken)
            {
                var state           = new SigningState(requestTemplate, options, blobSigner, clock);
                var base64Signature = await blobSigner.CreateSignatureAsync(state._blobToSign, cancellationToken).ConfigureAwait(false);

                var rawSignature = Convert.FromBase64String(base64Signature);
                var hexSignature = FormatHex(rawSignature);

                return(state.GetResult(hexSignature));
            }
예제 #5
0
            public string Sign(
                string bucket,
                string objectName,
                DateTimeOffset expiration,
                HttpMethod requestMethod,
                Dictionary <string, IEnumerable <string> > requestHeaders,
                Dictionary <string, IEnumerable <string> > contentHeaders,
                IBlobSigner blobSigner,
                IClock clock)
            {
                var state     = new SigningState(bucket, objectName, expiration, requestMethod, requestHeaders, contentHeaders, blobSigner);
                var signature = blobSigner.CreateSignature(state.blobToSign);

                return(state.GetResult(signature));
            }
예제 #6
0
            public async Task <string> SignAsync(
                string bucket,
                string objectName,
                DateTimeOffset expiration,
                HttpMethod requestMethod,
                Dictionary <string, IEnumerable <string> > requestHeaders,
                Dictionary <string, IEnumerable <string> > contentHeaders,
                IBlobSigner blobSigner,
                IClock clock,
                CancellationToken cancellationToken)
            {
                var state     = new SigningState(bucket, objectName, expiration, requestMethod, requestHeaders, contentHeaders, blobSigner);
                var signature = await blobSigner.CreateSignatureAsync(state.blobToSign, cancellationToken).ConfigureAwait(false);

                return(state.GetResult(signature));
            }
            // Note: It's irritating to have to convert from base64 to bytes and then to hex, but we can't change the IBlobSigner implementation
            // and ServiceAccountCredential.CreateSignature returns base64 anyway.

            public string Sign(
                string bucket,
                string objectName,
                DateTimeOffset expiration,
                HttpMethod requestMethod,
                Dictionary <string, IEnumerable <string> > requestHeaders,
                Dictionary <string, IEnumerable <string> > contentHeaders,
                IBlobSigner blobSigner,
                IClock clock)
            {
                var state           = new SigningState(bucket, objectName, expiration, requestMethod, requestHeaders, contentHeaders, blobSigner, clock);
                var base64Signature = blobSigner.CreateSignature(state._blobToSign);
                var rawSignature    = Convert.FromBase64String(base64Signature);
                var hexSignature    = FormatHex(rawSignature);

                return(state.GetResult(hexSignature));
            }