Diff

mod_http_oauth2/mod_http_oauth2.lua @ 5204:eb8b3a068ecc

mod_http_oauth2: Return list of active roles in discovery Relies on Prosody trunk rev cdb996637b08 Better than a hardcoded list
author Kim Alvefur <zash@zash.se>
date Sat, 04 Mar 2023 21:36:00 +0100
parent 5203:c60cff787d6a
child 5205:b6f41f0b5f58
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Sat Mar 04 21:24:35 2023 +0100
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Sat Mar 04 21:36:00 2023 +0100
@@ -478,7 +478,8 @@
 				token_endpoint = handle_token_grant and module:http_url() .. "/token" or nil;
 				jwks_uri = nil; -- TODO?
 				registration_endpoint = handle_register_request and module:http_url() .. "/register" or nil;
-				scopes_supported = { "prosody:restricted"; "prosody:user"; "prosody:admin"; "prosody:operator" };
+				scopes_supported = usermanager.get_all_roles and array(it.keys(usermanager.get_all_roles()))
+					or { "prosody:restricted"; "prosody:user"; "prosody:admin"; "prosody:operator" };
 				response_types_supported = array(it.keys(response_type_handlers));
 				authorization_response_iss_parameter_supported = true;
 			};