Skip to content

Commit fdd532d

Browse files
refactor: simplify key metadata handling in issuer key retrieval
Removes unnecessary key_ids intermediate table and conditional kid assignment loop. Directly assigns kids array to return value, reducing code complexity while maintaining the same functionality. The kids array is now passed through unchanged instead of being conditionally copied element by element.
1 parent c78adca commit fdd532d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/handler.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,14 @@ local function custom_helper_issuer_get_keys(well_known_endpoint, cafile)
113113
end
114114

115115
local decoded_keys = {}
116-
local key_ids = {}
117116
for i, key in ipairs(keys) do
118117
decoded_keys[i] = custom_base64_decode(key)
119-
if kids then
120-
key_ids[i] = kids[i]
121-
end
122118
end
123119

124120
kong.log.debug('Number of keys retrieved: ' .. table.getn(decoded_keys))
125121
return {
126122
keys = decoded_keys,
127-
kids = key_ids,
123+
kids = kids,
128124
key_metadata = key_metadata,
129125
updated_at = socket.gettime()
130126
}

0 commit comments

Comments
 (0)