通过相对路径获取授权签名

This commit is contained in:
2024-07-26 09:04:34 +08:00
parent 9a958276db
commit cad7132b0a
3 changed files with 19 additions and 14 deletions
+13 -5
View File
@@ -375,10 +375,6 @@ namespace IRaCIS.Core.Application.Helper
.WithCredentials(minIOConfig.accessKey, minIOConfig.secretKey).WithSSL(minIOConfig.useSSL)
.Build();
//var reqParams = new Dictionary<string, string>(StringComparer.Ordinal)
// {
// { "response-content-type", "application/json" }
// };
var args = new PresignedGetObjectArgs()
.WithBucket(minIOConfig.bucketName)
@@ -404,7 +400,19 @@ namespace IRaCIS.Core.Application.Helper
.WithCredentials(minIOConfig.accessKey, minIOConfig.secretKey).WithSSL(minIOConfig.useSSL)
.Build();
return string.Empty;
var args = new PresignedGetObjectArgs()
.WithBucket(minIOConfig.bucketName)
.WithObject(ossRelativePath)
.WithExpiry(3600);
var presignedUrl = await minioClient.PresignedGetObjectAsync(args);
Uri uri = new Uri(presignedUrl);
string relativePath = uri.PathAndQuery;
return relativePath;
}
else
{