From 7714d67b46e6523110358a6cd5f789b87f183085 Mon Sep 17 00:00:00 2001 From: zhenlei520 Date: Wed, 18 May 2022 10:05:55 +0800 Subject: [PATCH] fix(Storage.Aliyun): Whether the removal of Sts request is successful or not --- .../Client.cs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Storage/Masa.Contrib.Storage.ObjectStorage.Aliyun/Client.cs b/src/Storage/Masa.Contrib.Storage.ObjectStorage.Aliyun/Client.cs index 618c20af2..a9d16b5dd 100644 --- a/src/Storage/Masa.Contrib.Storage.ObjectStorage.Aliyun/Client.cs +++ b/src/Storage/Masa.Contrib.Storage.ObjectStorage.Aliyun/Client.cs @@ -65,19 +65,20 @@ protected virtual TemporaryCredentialsResponse GetTemporaryCredentials( if (!string.IsNullOrEmpty(policy)) request.Policy = policy; var response = client.GetAcsResponse(request); - if (response.HttpResponse.isSuccess()) - { - return new TemporaryCredentialsResponse( - response.Credentials.AccessKeyId, - response.Credentials.AccessKeySecret, - response.Credentials.SecurityToken, - DateTime.Parse(response.Credentials.Expiration)); - } - - string message = $"Aliyun.Client: Failed to obtain temporary credentials, RequestId: {response.RequestId},Status: {response.HttpResponse.Status}, Message: {System.Text.Encoding.Default.GetString(response.HttpResponse.Content)}"; - _logger?.LogWarning(message); - throw new Exception(message); + // if (response.HttpResponse.isSuccess()) + // { + return new TemporaryCredentialsResponse( //todo: Get Sts response information is null, waiting for repair: https://github.com/aliyun/aliyun-openapi-net-sdk/pull/401 + response.Credentials.AccessKeyId, + response.Credentials.AccessKeySecret, + response.Credentials.SecurityToken, + DateTime.Parse(response.Credentials.Expiration)); + // } + // + // string message = $"Aliyun.Client: Failed to obtain temporary credentials, RequestId: {response.RequestId},Status: {response.HttpResponse.Status}, Message: {System.Text.Encoding.Default.GetString(response.HttpResponse.Content)}"; + // _logger?.LogWarning(message); + // + // throw new Exception(message); } protected virtual void SetTemporaryCredentials(TemporaryCredentialsResponse credentials)