Software /
code /
prosody-modules
Comparison
mod_groups_oidc/mod_groups_oidc.lua @ 5676:62c6e17a5e9d
Merge
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Mon, 18 Sep 2023 08:24:19 -0500 |
parent | 5504:7d9dce4e7dd0 |
comparison
equal
deleted
inserted
replaced
5675:eade7ff9f52c | 5676:62c6e17a5e9d |
---|---|
1 local array = require "util.array"; | |
2 | |
3 module:add_item("openid-claim", "groups"); | |
4 | |
5 local group_memberships = module:open_store("groups", "map"); | |
6 local function user_groups(username) | |
7 return pairs(group_memberships:get_all(username) or {}); | |
8 end | |
9 | |
10 module:hook("token/userinfo", function(event) | |
11 local userinfo = event.userinfo; | |
12 if event.claims:contains("groups") then | |
13 userinfo.groups = array(user_groups(event.username)); | |
14 end | |
15 end); |