Software / code / prosody-modules
Comparison
mod_http_oauth2/mod_http_oauth2.lua @ 6322:dfc035ecabb4
mod_http_oauth2: Remove defaults that should be included on clients
Since create_client() adds these fields if they are missing, we can
assume that they are present.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 03 Jul 2025 12:32:43 +0200 |
| parent | 6321:e174e12549e1 |
| child | 6323:4f9b42c53d0f |
comparison
equal
deleted
inserted
replaced
| 6321:e174e12549e1 | 6322:dfc035ecabb4 |
|---|---|
| 911 return oauth_error("invalid_client", "incorrect credentials"); | 911 return oauth_error("invalid_client", "incorrect credentials"); |
| 912 end | 912 end |
| 913 | 913 |
| 914 | 914 |
| 915 local grant_type = params.grant_type | 915 local grant_type = params.grant_type |
| 916 if not array_contains(client.grant_types or { "authorization_code" }, grant_type) then | 916 if not array_contains(client.grant_types, grant_type) then |
| 917 return oauth_error("invalid_request", "'grant_type' not registered"); | 917 return oauth_error("invalid_request", "'grant_type' not registered"); |
| 918 end | 918 end |
| 919 | 919 |
| 920 local grant_handler = grant_type_handlers[grant_type]; | 920 local grant_handler = grant_type_handlers[grant_type]; |
| 921 if not grant_handler then | 921 if not grant_handler then |
| 952 return render_error(oauth_error("invalid_request", "Invalid 'redirect_uri' parameter")); | 952 return render_error(oauth_error("invalid_request", "Invalid 'redirect_uri' parameter")); |
| 953 end | 953 end |
| 954 -- From this point we know that redirect_uri is safe to use | 954 -- From this point we know that redirect_uri is safe to use |
| 955 | 955 |
| 956 local response_type = params.response_type; | 956 local response_type = params.response_type; |
| 957 if not array_contains(client.response_types or { "code" }, response_type) then | 957 if not array_contains(client.response_types, response_type) then |
| 958 return error_response(request, redirect_uri, oauth_error("invalid_client", "'response_type' not registered")); | 958 return error_response(request, redirect_uri, oauth_error("invalid_client", "'response_type' not registered")); |
| 959 end | 959 end |
| 960 if not allowed_response_type_handlers:contains(response_type) then | 960 if not allowed_response_type_handlers:contains(response_type) then |
| 961 return error_response(request, redirect_uri, oauth_error("unsupported_response_type", "'response_type' not allowed")); | 961 return error_response(request, redirect_uri, oauth_error("unsupported_response_type", "'response_type' not allowed")); |
| 962 end | 962 end |