测试oss 改为1分钟

Uat_Study
hang 2023-09-26 14:13:07 +08:00
parent 5bdb89df7d
commit b3e37c7ea4
1 changed files with 5 additions and 2 deletions

View File

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