Comparison

mod_http_oauth2/mod_http_oauth2.lua @ 4228:3eb595cf847f

mod_http_oauth2: Accept empty scope Some tool I used couldn't not send a scope, preventing it from working with mod_http_oauth2. This change should fix that.
author Kim Alvefur <zash@zash.se>
date Fri, 23 Oct 2020 22:23:20 +0200
parent 3934:469408682152
child 4237:a0ab7be0538d
comparison
equal deleted inserted replaced
4227:13b065432bf2 4228:3eb595cf847f
30 30
31 function grant_type_handlers.password(params) 31 function grant_type_handlers.password(params)
32 local request_jid = assert(params.username, oauth_error("invalid_request", "missing 'username' (JID)")); 32 local request_jid = assert(params.username, oauth_error("invalid_request", "missing 'username' (JID)"));
33 local request_password = assert(params.password, oauth_error("invalid_request", "missing 'password'")); 33 local request_password = assert(params.password, oauth_error("invalid_request", "missing 'password'"));
34 local request_username, request_host, request_resource = jid.prepped_split(request_jid); 34 local request_username, request_host, request_resource = jid.prepped_split(request_jid);
35 if params.scope then 35 if params.scope and param.scope ~= "" then
36 return oauth_error("invalid_scope", "unknown scope requested"); 36 return oauth_error("invalid_scope", "unknown scope requested");
37 end 37 end
38 if not (request_username and request_host) or request_host ~= module.host then 38 if not (request_username and request_host) or request_host ~= module.host then
39 return oauth_error("invalid_request", "invalid JID"); 39 return oauth_error("invalid_request", "invalid JID");
40 end 40 end