public static string GetPresignedUrl(GetPresignedUrlRequest request, IAwsCredential credential, DateTime now) { HttpMethod method = request.Method.Equals("GET") ? HttpMethod.Get : new HttpMethod(request.Method); // TODO: support version querystring return(SignerV4.GetPresignedUrl( credential: credential, scope: new CredentialScope(now, request.Region, AwsService.S3), date: now, expires: request.ExpiresIn, method: method, requestUri: new Uri(request.GetUrl()), payloadHash: UnsignedPayload )); }
public static string GetPresignedUrl(GetPresignedUrlRequest request, IAwsCredential credential, DateTime now) { var scope = new CredentialScope(now, request.Region, AwsService.S3); var urlBuilder = StringBuilderCache.Aquire() .Append("https://") .Append(request.Host) .Append('/') .Append(request.BucketName) .Append('/') .Append(request.Key); // TODO: support version querystring var message = new HttpRequestMessage(new HttpMethod(request.Method), StringBuilderCache.ExtractAndRelease(urlBuilder)); SignerV4.Default.Presign(credential, scope, now, request.ExpiresIn, message, "UNSIGNED-PAYLOAD"); string signedUrl = message.RequestUri.ToString(); return(signedUrl); }
public string GetPresignedUrl(string key, TimeSpan expiresIn) { var request = new GetPresignedUrlRequest(client.Host, client.Region, bucketName, key, expiresIn); return(client.GetPresignedUrl(in request)); }
public static string GetPresignedUrl(GetPresignedUrlRequest request, IAwsCredential credential) { return(GetPresignedUrl(request, credential, DateTime.UtcNow)); }
public string GetPresignedUrl(GetPresignedUrlRequest request) { return(S3Helper.GetPresignedUrl(request, credential)); }