فهرست منبع

测试缩短sts有效期

lang 4 سال پیش
والد
کامیت
d45b9d675b
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      Controller/CloudStorage.py

+ 3 - 3
Controller/CloudStorage.py

@@ -349,7 +349,7 @@ class CloudStorageView(View):
             sts_qs = StsCrdModel.objects.filter(uid=uid, channel=channel). \
             sts_qs = StsCrdModel.objects.filter(uid=uid, channel=channel). \
                 values("addTime", "data")
                 values("addTime", "data")
             if sts_qs.exists():
             if sts_qs.exists():
-                endTime = int(sts_qs[0]["addTime"]) + 3500
+                endTime = int(sts_qs[0]["addTime"]) + 250
                 if endTime > now_time:
                 if endTime > now_time:
                     print(endTime)
                     print(endTime)
                     print(now_time)
                     print(now_time)
@@ -390,7 +390,7 @@ class CloudStorageView(View):
             response = boto3_sts.get_federation_token(
             response = boto3_sts.get_federation_token(
                 Name='{role_name}'.format(role_name=uid + '_' + str(channel)),
                 Name='{role_name}'.format(role_name=uid + '_' + str(channel)),
                 Policy=json.dumps(Policy),
                 Policy=json.dumps(Policy),
-                DurationSeconds=7200
+                DurationSeconds=300
             )
             )
             ##############
             ##############
             res = {
             res = {
@@ -398,7 +398,7 @@ class CloudStorageView(View):
                 'AccessKeySecret': response['Credentials']['SecretAccessKey'],
                 'AccessKeySecret': response['Credentials']['SecretAccessKey'],
                 'SessionToken': response['Credentials']['SessionToken'],
                 'SessionToken': response['Credentials']['SessionToken'],
                 'Expiration': response['Credentials']['Expiration'],
                 'Expiration': response['Credentials']['Expiration'],
-                'expire': '7200',
+                'expire': 300,
                 'endpoint': endpoint,
                 'endpoint': endpoint,
                 'bucket_name': bucket_name,
                 'bucket_name': bucket_name,
                 'arn': response['FederatedUser']['Arn'],
                 'arn': response['FederatedUser']['Arn'],