comparison mod_http_oauth2/mod_http_oauth2.lua @ 5468:14b5446e22e1

mod_http_oauth2: Fix returning errors from response handlers This would either redirect the user back to the client along with the error code, or show the error HTML template. Previously this would just show some JSON to the user.
author Kim Alvefur <zash@zash.se>
date Thu, 18 May 2023 12:57:23 +0200
parents 1c78a97a1091
children 03f393d572fe
comparison
equal deleted inserted replaced
5467:1c78a97a1091 5468:14b5446e22e1
752 local response_type = params.response_type; 752 local response_type = params.response_type;
753 local response_handler = response_type_handlers[response_type]; 753 local response_handler = response_type_handlers[response_type];
754 if not response_handler then 754 if not response_handler then
755 return error_response(request, oauth_error("unsupported_response_type")); 755 return error_response(request, oauth_error("unsupported_response_type"));
756 end 756 end
757 return response_handler(client, params, user_jid, id_token); 757 local ret = response_handler(client, params, user_jid, id_token);
758 if errors.is_err(ret) then
759 return error_response(request, ret);
760 end
761 return ret;
758 end 762 end
759 763
760 local function handle_revocation_request(event) 764 local function handle_revocation_request(event)
761 local request, response = event.request, event.response; 765 local request, response = event.request, event.response;
762 if request.headers.authorization then 766 if request.headers.authorization then