|
@@ -227,13 +227,13 @@ func GetSTSVoucher(c *gin.Context) { |
|
|
for _, cfg := range *sysCfgs { |
|
|
for _, cfg := range *sysCfgs { |
|
|
cfgMap[cfg.Key] = cfg.Val |
|
|
cfgMap[cfg.Key] = cfg.Val |
|
|
} |
|
|
} |
|
|
|
|
|
endpoint := cfgMap[enum2.AliyunOssEndpoint] |
|
|
|
|
|
|
|
|
redisKey := STSVoucherRedisKey |
|
|
redisKey := STSVoucherRedisKey |
|
|
redisValue, err := cache.GetString(redisKey) |
|
|
redisValue, err := cache.GetString(redisKey) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
if err.Error() == "redigo: nil returned" { |
|
|
if err.Error() == "redigo: nil returned" { |
|
|
|
|
|
|
|
|
endpoint := cfgMap[enum2.AliyunOssEndpoint] |
|
|
|
|
|
assumeRoleAccessKeyID := cfgMap[enum2.AliyunOssAssumeRoleAccessKeyID] |
|
|
assumeRoleAccessKeyID := cfgMap[enum2.AliyunOssAssumeRoleAccessKeyID] |
|
|
assumeRoleAccessKeySecret := cfgMap[enum2.AliyunOssAssumeRoleAccessKeySecret] |
|
|
assumeRoleAccessKeySecret := cfgMap[enum2.AliyunOssAssumeRoleAccessKeySecret] |
|
|
assumeRoleARN := cfgMap[enum2.AliyunOssAssumeRoleARN] |
|
|
assumeRoleARN := cfgMap[enum2.AliyunOssAssumeRoleARN] |
|
@@ -249,7 +249,6 @@ func GetSTSVoucher(c *gin.Context) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
roleArn := assumeRoleARN |
|
|
roleArn := assumeRoleARN |
|
|
fmt.Println(roleArn) |
|
|
|
|
|
durationSeconds := 3600 |
|
|
durationSeconds := 3600 |
|
|
|
|
|
|
|
|
assumeRoleResponse, err := svc.AssumeRole(client, &roleArn, &roleSessionName, int64(durationSeconds)) |
|
|
assumeRoleResponse, err := svc.AssumeRole(client, &roleArn, &roleSessionName, int64(durationSeconds)) |
|
@@ -287,7 +286,7 @@ func GetSTSVoucher(c *gin.Context) { |
|
|
var credentials sts20150401.AssumeRoleResponseBodyCredentials |
|
|
var credentials sts20150401.AssumeRoleResponseBodyCredentials |
|
|
utils.Unserialize([]byte(redisValue), &credentials) |
|
|
utils.Unserialize([]byte(redisValue), &credentials) |
|
|
bucket := cfgMap[enum2.AliyunOssBucketName] |
|
|
bucket := cfgMap[enum2.AliyunOssBucketName] |
|
|
region := strings.Split(bucket, ".")[0] |
|
|
|
|
|
|
|
|
region := strings.Split(endpoint, ".")[0] |
|
|
|
|
|
|
|
|
resp := GetSTSVoucherResp{ |
|
|
resp := GetSTSVoucherResp{ |
|
|
STSToken: credentials, |
|
|
STSToken: credentials, |
|
|