Changeset

6340:c96bd4156664

mod_http_oauth2: Fix passing roles and scopes the same way to template
author Kim Alvefur <zash@zash.se>
date Tue, 15 Jul 2025 21:55:25 +0200
parents 6339:24559118dd6c
children 6341:3f0970babd67
files mod_http_oauth2/mod_http_oauth2.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Tue Jul 15 21:53:37 2025 +0200
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Tue Jul 15 21:55:25 2025 +0200
@@ -40,6 +40,12 @@
 	return false
 end
 
+local function array_filter(haystack)
+	return function (needle)
+		return array_contains(haystack, needle);
+	end
+end
+
 local function strict_url_parse(urlstr)
 	local url_parts = url.parse(urlstr);
 	if not url_parts then return url_parts; end
@@ -1053,10 +1059,10 @@
 			end);
 			for _, role in ipairs(roles) do
 				if role == "xmpp" then
-					scope_choices:push({ scope = role; title = "XMPP";
+					scope_choices:push({ claim = role; title = "XMPP";
 						description = "Unlimited access to your account, including sending and receiving messages."; });
 				else
-					scope_choices:push({ scope = role; title = role, description = "Prosody Role" });
+					scope_choices:push({ claim = role; title = role, description = "Prosody Role" });
 				end
 			end
 			return render_page(templates.consent, { state = auth_state; client = client; scopes = scope_choices }, true);