diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs index b7fda66b0e..e504e30d77 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs @@ -6,11 +6,11 @@ namespace Volo.Abp.BlobStoring.Aliyun public class AliyunBlobNamingNormalizer : IBlobNamingNormalizer, ITransientDependency { /// - /// 只允许小写字母、数字、短横线(-),且不能以短横线开头或结尾 /// Container names can contain only letters, numbers, and the dash (-) character - /// can't start or end with the dash (-) character - /// 3~63 个字符 + /// they can't start or end with the dash (-) character /// Container names must be from 3 through 63 characters long + /// 只允许小写字母、数字、短横线(-),且不能以短横线开头或结尾 + /// 3~63 个字符 /// public virtual string NormalizeContainerName(string containerName) { diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs index 90cbe1912b..a4be7cabc2 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs @@ -3,7 +3,9 @@ namespace Volo.Abp.BlobStoring.Aliyun { /// - /// STS临时授权访问OSS:https://help.aliyun.com/document_detail/100624.html + /// Sub-account access to OSS or STS temporary authorization to access OSS + /// 子账号/STS临时授权访问OSS + /// https://help.aliyun.com/document_detail/100624.html /// public class AliyunBlobProviderConfiguration { @@ -48,12 +50,20 @@ namespace Volo.Abp.BlobStoring.Aliyun set => _containerConfiguration.SetConfiguration(AliyunBlobProviderConfigurationNames.RoleArn, value); } + /// + /// The name used to identify the temporary access credentials, it is recommended to use different application users to distinguish. + /// 用来标识临时访问凭证的名称,建议使用不同的应用程序用户来区分。 + /// public string RoleSessionName { get => _containerConfiguration.GetConfiguration(AliyunBlobProviderConfigurationNames.RoleSessionName); set => _containerConfiguration.SetConfiguration(AliyunBlobProviderConfigurationNames.RoleSessionName, value); } + /// + /// Set the validity period of the temporary access credential, the unit is s, the minimum is 900, and the maximum is 3600. + /// 设置临时访问凭证的有效期,单位是s,最小为900,最大为3600。 + /// public int DurationSeconds { get => _containerConfiguration.GetConfigurationOrDefault(AliyunBlobProviderConfigurationNames.DurationSeconds, 0); diff --git a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/DefaultOssClientFactory.cs b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/DefaultOssClientFactory.cs index a794d8c25a..1e379291ed 100644 --- a/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/DefaultOssClientFactory.cs +++ b/framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/DefaultOssClientFactory.cs @@ -11,8 +11,9 @@ using Volo.Abp.DependencyInjection; namespace Volo.Abp.BlobStoring.Aliyun { /// + /// Sub-account access to OSS or STS temporary authorization to access OSS + /// 子账号/STS临时授权访问OSS /// STS:https://help.aliyun.com/document_detail/28756.html - /// STS or sub account number /// public class DefaultOssClientFactory : IOssClientFactory, ITransientDependency { @@ -28,7 +29,7 @@ namespace Volo.Abp.BlobStoring.Aliyun public virtual IOss Create(AliyunBlobProviderConfiguration aliyunConfig) { - //使用账号 sub account number + //Sub-account if (aliyunConfig.DurationSeconds <= 0) { var key = aliyunConfig.ToOssKeyString(); @@ -43,7 +44,7 @@ namespace Volo.Abp.BlobStoring.Aliyun } else { - //使用STS + //STS temporary authorization to access OSS var key = aliyunConfig.ToOssWithStsKeyString(); var iOssClient = _cache.Get(key); if (iOssClient != null) @@ -55,16 +56,15 @@ namespace Volo.Abp.BlobStoring.Aliyun aliyunConfig.AccessKeyId, aliyunConfig.AccessKeySecret); DefaultAcsClient client = new DefaultAcsClient(profile); - //构建AssumeRole请求 AssumeRoleRequest request = new AssumeRoleRequest { AcceptFormat = FormatType.JSON, - //指定角色ARN + //eg:acs:ram::$accountID:role/$roleName RoleArn = aliyunConfig.RoleArn, RoleSessionName = aliyunConfig.RoleSessionName, - //设置Token有效期,可选参数,默认3600秒 + //Set the validity period of the temporary access credential, the unit is s, the minimum is 900, and the maximum is 3600. default 3600 DurationSeconds = aliyunConfig.DurationSeconds, - //设置Token的附加权限策略;在获取Token时,通过额外设置一个权限策略进一步减小Token的权限 + //Set additional permission policy of Token; when acquiring Token, further reduce the permission of Token by setting an additional permission policy Policy = aliyunConfig.Policy.IsNullOrEmpty() ? null : aliyunConfig.Policy, }; var response = client.GetAcsResponse(request); diff --git a/framework/test/Volo.Abp.BlobStoring.Aliyun.Tests/Volo/Abp/BlobStoring/Aliyun/AbpBlobStoringAliyunTestModule.cs b/framework/test/Volo.Abp.BlobStoring.Aliyun.Tests/Volo/Abp/BlobStoring/Aliyun/AbpBlobStoringAliyunTestModule.cs index 4a63887fda..f62fe9e4b6 100644 --- a/framework/test/Volo.Abp.BlobStoring.Aliyun.Tests/Volo/Abp/BlobStoring/Aliyun/AbpBlobStoringAliyunTestModule.cs +++ b/framework/test/Volo.Abp.BlobStoring.Aliyun.Tests/Volo/Abp/BlobStoring/Aliyun/AbpBlobStoringAliyunTestModule.cs @@ -5,10 +5,6 @@ using Volo.Abp.Modularity; namespace Volo.Abp.BlobStoring.Aliyun { - - /// - /// This module will not try to connect to azure. - /// [DependsOn( typeof(AbpBlobStoringAliyunModule), typeof(AbpBlobStoringTestModule)