oss 临时凭证

This commit is contained in:
wangw 2024-12-05 13:51:32 +08:00
parent a0a732662b
commit 26fbe47f44
3 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,7 @@ public interface CommonInfoService {
/** /**
* 获取一个对象 * 获取一个对象
*/ */
CommonInfo findOne(int id); CommonInfo findOne(int type);
/** /**
* 删除一个 * 删除一个

View File

@ -45,8 +45,8 @@ public class CommonInfoServiceImpl extends ServiceImpl<CommonInfoDao, CommonInfo
@Override @Override
public CommonInfo findOne(int id) { public CommonInfo findOne(int type) {
return commonInfoDao.findOne(id); return commonInfoDao.findOne(type);
} }
@Override @Override

View File

@ -70,17 +70,17 @@ public class AliFileUploadController {
try { try {
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config() com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
// 必填请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID // 必填请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID
// .setAccessKeyId("LTAI5tMmymNJatAoci3N5PVz") // .setAccessKeyId("LTAI5tDzyrWMT2YYTMkUXdpy")
.setAccessKeyId(commonRepository.findOne(68).getValue()) .setAccessKeyId(commonRepository.findOne(69).getValue())
// 必填请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET // 必填请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET
.setAccessKeySecret(commonRepository.findOne(69).getValue()); .setAccessKeySecret(commonRepository.findOne(70).getValue());
// .setAccessKeySecret("WnJ2Dng7zxSagKj0NmhjfiHgIFyOEy"); // .setAccessKeySecret("ssOeOi4IsIrsbtiyWW4tWOYbjbO0Kp");
// Endpoint 请参考 https://api.aliyun.com/product/Sts // Endpoint 请参考 https://api.aliyun.com/product/Sts
config.endpoint = "sts.cn-shanghai.aliyuncs.com"; config.endpoint = commonRepository.findOne(66).getValue();
com.aliyun.sts20150401.Client client = new com.aliyun.sts20150401.Client(config); com.aliyun.sts20150401.Client client = new com.aliyun.sts20150401.Client(config);
com.aliyun.sts20150401.models.AssumeRoleRequest assumeRoleRequest = new com.aliyun.sts20150401.models.AssumeRoleRequest(); com.aliyun.sts20150401.models.AssumeRoleRequest assumeRoleRequest = new com.aliyun.sts20150401.models.AssumeRoleRequest();
assumeRoleRequest.setRoleArn(commonRepository.findOne(76).getValue()); assumeRoleRequest.setRoleArn(commonRepository.findOne(67).getValue());
assumeRoleRequest.setRoleSessionName("test"); assumeRoleRequest.setRoleSessionName("test");
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions(); com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
// 复制代码运行请自行打印 API 的返回值 // 复制代码运行请自行打印 API 的返回值