diff --git a/IRaCIS.Core.API/Controllers/ExtraController.cs b/IRaCIS.Core.API/Controllers/ExtraController.cs index 3722593db..b245633d8 100644 --- a/IRaCIS.Core.API/Controllers/ExtraController.cs +++ b/IRaCIS.Core.API/Controllers/ExtraController.cs @@ -148,12 +148,15 @@ namespace IRaCIS.Api.Controllers IClientProfile profile = DefaultProfile.GetProfile("cn-shanghai", configuration["AliyunOSS:accessKeyId"], configuration["AliyunOSS:accessKeySecret"]); DefaultAcsClient client = new DefaultAcsClient(profile); + + + // 创建一个STS请求 AssumeRoleRequest request = new AssumeRoleRequest { RoleArn = "acs:ram::1899121822495495:role/oss-upload", // 角色ARN,需要替换为你的角色ARN - RoleSessionName = "session-name", // 角色会话名称,可自定义 - DurationSeconds = 3600, // 令牌有效期(单位:秒),这里设置为1小时 + RoleSessionName = $"session-name-{Guid.NewGuid()}", // 角色会话名称,可自定义 + DurationSeconds = 60, // 令牌有效期(单位:秒),这里设置为1小时 };