Comparison

mod_http_oauth2/mod_http_oauth2.lua @ 4257:145e8e8a247a

mod_http_oauth2: Fix incomplete function arity change in dea6bea2ddd3
author Kim Alvefur <zash@zash.se>
date Sat, 21 Nov 2020 16:05:55 +0100
parent 4256:c4b9d4ba839b
child 4258:cc712899becd
comparison
equal deleted inserted replaced
4256:c4b9d4ba839b 4257:145e8e8a247a
46 if not (request_username and request_host) or request_host ~= module.host then 46 if not (request_username and request_host) or request_host ~= module.host then
47 return oauth_error("invalid_request", "invalid JID"); 47 return oauth_error("invalid_request", "invalid JID");
48 end 48 end
49 if usermanager.test_password(request_username, request_host, request_password) then 49 if usermanager.test_password(request_username, request_host, request_password) then
50 local granted_jid = jid.join(request_username, request_host, request_resource); 50 local granted_jid = jid.join(request_username, request_host, request_resource);
51 return json.encode(new_access_token(granted_jid, request_host, nil, nil)); 51 return json.encode(new_access_token(granted_jid, nil, nil));
52 end 52 end
53 return oauth_error("invalid_grant", "incorrect credentials"); 53 return oauth_error("invalid_grant", "incorrect credentials");
54 end 54 end
55 55
56 function response_type_handlers.code(params, granted_jid) 56 function response_type_handlers.code(params, granted_jid)
146 if not request_host or request_host ~= module.host then 146 if not request_host or request_host ~= module.host then
147 return oauth_error("invalid_request", "invalid JID"); 147 return oauth_error("invalid_request", "invalid JID");
148 end 148 end
149 if request_password == component_secret then 149 if request_password == component_secret then
150 local granted_jid = jid.join(request_username, request_host, request_resource); 150 local granted_jid = jid.join(request_username, request_host, request_resource);
151 return json.encode(new_access_token(granted_jid, request_host, nil, nil)); 151 return json.encode(new_access_token(granted_jid, nil, nil));
152 end 152 end
153 return oauth_error("invalid_grant", "incorrect credentials"); 153 return oauth_error("invalid_grant", "incorrect credentials");
154 end 154 end
155 155
156 -- TODO How would this make sense with components? 156 -- TODO How would this make sense with components?