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