comparison mod_http_oauth2/mod_http_oauth2.lua @ 5614:7565298aa197

mod_http_oauth2: Allow a shorter form of the device grant in config Long URI is long
author Kim Alvefur <zash@zash.se>
date Fri, 21 Jul 2023 00:37:34 +0200
parents 1893ae742f66
children 59d5fc50f602
comparison
equal deleted inserted replaced
5613:a9682cad0e67 5614:7565298aa197
745 "authorization_code"; 745 "authorization_code";
746 "password"; -- TODO Disable. The resource owner password credentials grant [RFC6749] MUST NOT be used. 746 "password"; -- TODO Disable. The resource owner password credentials grant [RFC6749] MUST NOT be used.
747 "refresh_token"; 747 "refresh_token";
748 device_uri; 748 device_uri;
749 }) 749 })
750 if allowed_grant_type_handlers:contains("device_code") then
751 -- expand short form because that URI is long
752 module:log("debug", "Expanding %q to %q in '%s'", "device_code", device_uri, "allowed_oauth2_grant_types");
753 allowed_grant_type_handlers:remove("device_code");
754 allowed_grant_type_handlers:add(device_uri);
755 end
750 for handler_type in pairs(grant_type_handlers) do 756 for handler_type in pairs(grant_type_handlers) do
751 if not allowed_grant_type_handlers:contains(handler_type) then 757 if not allowed_grant_type_handlers:contains(handler_type) then
752 module:log("debug", "Grant type %q disabled", handler_type); 758 module:log("debug", "Grant type %q disabled", handler_type);
753 grant_type_handlers[handler_type] = nil; 759 grant_type_handlers[handler_type] = nil;
754 else 760 else