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
public CommonInfo findOne(int id) {
return commonInfoDao.findOne(id);
public CommonInfo findOne(int type) {
return commonInfoDao.findOne(type);
}
@Override

View File

@ -70,17 +70,17 @@ public class AliFileUploadController {
try {
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
// 必填请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID
// .setAccessKeyId("LTAI5tMmymNJatAoci3N5PVz")
.setAccessKeyId(commonRepository.findOne(68).getValue())
// .setAccessKeyId("LTAI5tDzyrWMT2YYTMkUXdpy")
.setAccessKeyId(commonRepository.findOne(69).getValue())
// 必填请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET
.setAccessKeySecret(commonRepository.findOne(69).getValue());
// .setAccessKeySecret("WnJ2Dng7zxSagKj0NmhjfiHgIFyOEy");
.setAccessKeySecret(commonRepository.findOne(70).getValue());
// .setAccessKeySecret("ssOeOi4IsIrsbtiyWW4tWOYbjbO0Kp");
// 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.models.AssumeRoleRequest assumeRoleRequest = new com.aliyun.sts20150401.models.AssumeRoleRequest();
assumeRoleRequest.setRoleArn(commonRepository.findOne(76).getValue());
assumeRoleRequest.setRoleArn(commonRepository.findOne(67).getValue());
assumeRoleRequest.setRoleSessionName("test");
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
// 复制代码运行请自行打印 API 的返回值