Respect AD groups for the EDGE endpoints sharing
-- Common functions
+function arr_concat(t1,t2)
+ if t2 == nil then
+ return t1
+ end
+ for i=1,#t2 do
+ t1[#t1+1] = t2[i]
+ end
+ return t1
+end
+
local function arr_has_value (tab, val)
for index, value in ipairs(tab) do
if value:lower() == val:lower() then
@@ -87,7 +97,7 @@ if token then
"; User: " .. username .. "; Status: Authentication failed; Message: " .. jwt_obj.reason)
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
- local user_roles = jwt_obj["payload"]["roles"]
+ local user_roles = arr_concat(jwt_obj["payload"]["roles"], jwt_obj["payload"]["groups"])
local shared_with_users = split_str(ngx.var.shared_with_users, ',')
local shared_with_groups = split_str(ngx.var.shared_with_groups, ',')
