You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* added support for lua-resty-http lib and updated Makefile to execute integration tests
* [DOC] - documents dependency to lua-rest-http
* # refactored AWSIAMCredetials to use cachemanager and extracted an AwsDateConverter class
* removed unused `sharedCacheDictInstance` variable
Copyright 2016 Adobe Systems Incorporated. All rights reserved.
3
+
4
+
This file is licensed to you under the Apache License, Version 2.0 (the
5
+
"License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
6
+
7
+
http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR RESPRESENTATIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
10
+
]]
11
+
12
+
--
13
+
-- User: ddascal
14
+
-- Date: 19/03/16
15
+
-- Time: 21:40
16
+
-- To change this template use File | Settings | File Templates.
17
+
--
18
+
19
+
20
+
local_M= {}
21
+
22
+
--- Converts an AWS Date String into a timestamp number
23
+
-- @param dateString AWS Date String (i.e. 2016-03-19T06:44:17Z)
24
+
-- @param convertToUTC (default false). Boolean value to get the date in UTC or not
assert( shared_cache:get("AccessKeyId") == nil, "Expired token should not be saved in shared cache")
235
+
assert( shared_cache:get("iam_credentials") == nil, "iam_credentials should not be saved in shared cache, but found:" .. tostring(shared_cache:get("iam_credentials")))
227
236
228
237
-- the previous token should be expired and a new call to fetch credentials should get a new token
229
238
-- changing the iam_user will cause the IamCredentials to use this one when fetching new credentials
@@ -238,12 +247,14 @@ X-Test: test
238
247
if ( date ~= d ) then
239
248
error("Dates should match. Got" .. date .. ", Expected: " .. d)
240
249
end
241
-
242
-
assert( shared_cache:get("AccessKeyId") ~= nil, "AccessKeyId should be saved in shared cache")
243
-
assert( shared_cache:get("SecretAccessKey") ~= nil, "SecretAccessKey should be saved in shared cache")
244
-
assert( shared_cache:get("Token") ~= nil, "Token should be saved in shared cache")
245
-
assert( shared_cache:get("ExpireAt") ~= nil, "ExpireAt should be saved in shared cache")
246
-
assert( shared_cache:get("ExpireAtTimestamp") ~= nil, "ExpireAtTimestamp should be saved in shared cache")
250
+
local cachedIam = shared_cache:get("iam_credentials")
251
+
cachedIam = cjson.decode(cachedIam)
252
+
assert( cachedIam ~= nil, "iam_credentials should be saved in shared cache")
253
+
assert( cachedIam.AccessKeyId ~= nil, "AccessKeyId should be saved in shared cache")
254
+
assert( cachedIam.SecretAccessKey ~= nil, "SecretAccessKey should be saved in shared cache")
255
+
assert( cachedIam.Token ~= nil, "Token should be saved in shared cache")
256
+
assert( cachedIam.ExpireAt ~= nil, "ExpireAt should be saved in shared cache")
257
+
assert( cachedIam.ExpireAtTimestamp ~= nil, "ExpireAtTimestamp should be saved in shared cache")
0 commit comments