Comparison

mod_http_oauth2/mod_http_oauth2.lua @ 5264:d3ebaef1ea7a

mod_http_oauth2: Correctly verify OAuth client credentials on revocation Makes no sense to validate against username and password here, or using a token to revoke another token, or itself? In fact, upon further discussion, why do you need credentials to revoke a token? If you are not supposed to have the token, revoking it seems the most responsible thing to do with it, so it should be allowed, while if you are supposed to have it, you should be allowed to revoke it.
author Kim Alvefur <zash@zash.se>
date Tue, 21 Mar 2023 21:57:18 +0100
parent 5263:381c62ef52aa
child 5265:f845c218e52c
comparison
equal deleted inserted replaced
5263:381c62ef52aa 5264:d3ebaef1ea7a
575 return 401; 575 return 401;
576 elseif request.headers.content_type ~= "application/x-www-form-urlencoded" 576 elseif request.headers.content_type ~= "application/x-www-form-urlencoded"
577 or not request.body or request.body == "" then 577 or not request.body or request.body == "" then
578 return 400; 578 return 400;
579 end 579 end
580 local user = check_credentials(request, true); 580 local credentials = get_request_credentials(request);
581 if not user then 581 if not credentials or credentials.type ~= "basic" then
582 return 400;
583 end
584 -- OAuth "client" credentials
585 if not verify_client_secret(credentials.username, credentials.password) then
582 return 401; 586 return 401;
583 end 587 end
584 588
585 local form_data = http.formdecode(event.request.body); 589 local form_data = http.formdecode(event.request.body);
586 if not form_data or not form_data.token then 590 if not form_data or not form_data.token then