From bae4feceaa3ba4e03ab2df5159a3a2416d10539a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=90=95=E9=87=91=E6=B3=BD?= <1098696801@qq.com>
Date: Thu, 18 Apr 2024 04:05:39 +0000
Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20data?=
=?UTF-8?q?/magic-api/api/OSS/StsService.ms?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From 797e65e906c7d8628d83acfb5e5acd72d3599a75 Mon Sep 17 00:00:00 2001
From: zegezy <1098696801@qq.com>
Date: Thu, 18 Apr 2024 12:06:24 +0800
Subject: [PATCH 2/4] update
From 6b2b79f5726008a7f7e5ebbdfc67e1ade26562ee Mon Sep 17 00:00:00 2001
From: zegezy <1098696801@qq.com>
Date: Thu, 18 Apr 2024 12:13:30 +0800
Subject: [PATCH 3/4] update readme.md
---
README.md | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 45e32aa..a05ea44 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,15 @@
##
-后端:[ **https://gitee.com/ssssssss-team/magic-boot** ](https://gitee.com/ssssssss-team/magic-boot)
-前端:[ **https://gitee.com/ssssssss-team/magic-boot-naive** ](https://gitee.com/ssssssss-team/magic-boot-naive)
+后端:
+
+
+
+
+前端:
+
+
+
+
## 简介
From 0cfb84698dbe9c433b191d277b3719ee4a384a2e Mon Sep 17 00:00:00 2001
From: zegezy <1098696801@qq.com>
Date: Thu, 18 Apr 2024 12:21:50 +0800
Subject: [PATCH 4/4] update
---
data/magic-api/api/OSS/StsService.ms | 80 ++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)
create mode 100644 data/magic-api/api/OSS/StsService.ms
diff --git a/data/magic-api/api/OSS/StsService.ms b/data/magic-api/api/OSS/StsService.ms
new file mode 100644
index 0000000..ec9c665
--- /dev/null
+++ b/data/magic-api/api/OSS/StsService.ms
@@ -0,0 +1,80 @@
+{
+ "properties" : { },
+ "id" : "83fdef23ec05468a87e2271170f15823",
+ "script" : null,
+ "groupId" : "a73658de49cc4c1683e807418e6a88ab",
+ "name" : "StsService",
+ "createTime" : null,
+ "updateTime" : 1680320197000,
+ "lock" : null,
+ "createBy" : null,
+ "updateBy" : null,
+ "path" : "/sts/service",
+ "method" : "GET",
+ "parameters" : [ ],
+ "options" : [ {
+ "name" : "require_login",
+ "value" : "false",
+ "description" : "该接口需要登录才允许访问",
+ "required" : false,
+ "dataType" : "String",
+ "type" : null,
+ "defaultValue" : null,
+ "validateType" : null,
+ "error" : null,
+ "expression" : null,
+ "children" : null
+ } ],
+ "requestBody" : "",
+ "headers" : [ ],
+ "paths" : [ ],
+ "responseBody" : null,
+ "description" : null,
+ "requestBodyDefinition" : null,
+ "responseBodyDefinition" : null
+}
+================================
+import com.aliyuncs.DefaultAcsClient;
+import com.aliyuncs.auth.sts.AssumeRoleRequest;
+import com.aliyuncs.auth.sts.AssumeRoleResponse;
+import com.aliyuncs.exceptions.ClientException;
+import com.aliyuncs.http.MethodType;
+import com.aliyuncs.profile.DefaultProfile;
+import com.aliyuncs.profile.IClientProfile;
+import response
+import env
+
+if(env.get('oss.enable') == 'false'){
+ exit 500, '使用oss上传组件前请先配置oss信息'
+}
+
+// STS接入地址,例如sts.cn-hangzhou.aliyuncs.com。
+String endpoint = env.get("oss.endpoint");
+// 填写步骤1生成的访问密钥AccessKey ID和AccessKey Secret。
+String accessKeyId = env.get("oss.accessKeyId");
+String accessKeySecret = env.get("oss.accessKeySecret");
+// 填写步骤3获取的角色ARN。
+String roleArn = env.get("oss.roleArn");
+// 自定义角色会话名称,用来区分不同的令牌,例如可填写为SessionTest。
+String roleSessionName = env.get("oss.roleSessionName");
+
+// regionId表示RAM的地域ID。以华东1(杭州)地域为例,regionID填写为cn-hangzhou。也可以保留默认值,默认值为空字符串("")。
+String regionId = "";
+// 添加endpoint。适用于Java SDK 3.12.0及以上版本。
+DefaultProfile.addEndpoint(regionId, "Sts", endpoint);
+// 构造default profile。
+IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
+// 构造client。
+DefaultAcsClient client = new DefaultAcsClient(profile);
+AssumeRoleRequest request = new AssumeRoleRequest();
+// 适用于Java SDK 3.12.0及以上版本。
+request.setSysMethod(MethodType.POST);
+request.setRoleArn(roleArn);
+request.setRoleSessionName(roleSessionName);
+request.setDurationSeconds(43200L); // 设置临时访问凭证的有效时间为3600秒。
+AssumeRoleResponse assumeRoleResponse = client.getAcsResponse(request);
+return {
+ accessKeyId: assumeRoleResponse.getCredentials().getAccessKeyId(),
+ accessKeySecret: assumeRoleResponse.getCredentials().getAccessKeySecret(),
+ stsToken: assumeRoleResponse.getCredentials().getSecurityToken()
+}