修复:获取临时osstoken需登录才可以访问

This commit is contained in:
2025-07-01 17:04:09 +08:00
parent afce6628e2
commit 79040c8a64

View File

@@ -27,6 +27,7 @@ import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.BaseController; import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.common.system.entity.Company; import com.gxwebsoft.common.system.entity.Company;
import com.gxwebsoft.common.system.entity.FileRecord; import com.gxwebsoft.common.system.entity.FileRecord;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.service.CompanyService; import com.gxwebsoft.common.system.service.CompanyService;
import com.gxwebsoft.common.system.service.FileRecordService; import com.gxwebsoft.common.system.service.FileRecordService;
import com.gxwebsoft.common.system.service.SettingService; import com.gxwebsoft.common.system.service.SettingService;
@@ -197,6 +198,10 @@ public class AliOssController extends BaseController {
@ApiOperation("获取临时osstoken") @ApiOperation("获取临时osstoken")
@GetMapping("/getSTSToken") @GetMapping("/getSTSToken")
public ApiResult<?> getSTSToken() { public ApiResult<?> getSTSToken() {
final User loginUser = getLoginUser();
if(loginUser == null){
return fail("请先登录");
}
// STS接入地址例如sts.cn-hangzhou.aliyuncs.com。 // STS接入地址例如sts.cn-hangzhou.aliyuncs.com。
String endpoint = "sts.cn-shenzhen.aliyuncs.com"; String endpoint = "sts.cn-shenzhen.aliyuncs.com";
// 填写步骤1生成的RAM用户访问密钥AccessKey ID和AccessKey Secret。 // 填写步骤1生成的RAM用户访问密钥AccessKey ID和AccessKey Secret。