Mercurial > prosody-modules
comparison mod_http_oauth2/mod_http_oauth2.lua @ 5224:cd5cf4cc6304
mod_http_oauth2: Fail early when no authorization header present
Fixes traceback.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 07 Mar 2023 15:31:19 +0000 |
| parents | 8b2a36847912 |
| children | 3439eb37f23b |
comparison
equal
deleted
inserted
replaced
| 5223:8b2a36847912 | 5224:cd5cf4cc6304 |
|---|---|
| 340 | 340 |
| 341 return {}; | 341 return {}; |
| 342 end | 342 end |
| 343 | 343 |
| 344 local function get_request_credentials(request) | 344 local function get_request_credentials(request) |
| 345 if not request.headers.authorization then return; end | |
| 346 | |
| 345 local auth_type, auth_data = string.match(request.headers.authorization, "^(%S+)%s(.+)$"); | 347 local auth_type, auth_data = string.match(request.headers.authorization, "^(%S+)%s(.+)$"); |
| 346 | 348 |
| 347 if auth_type == "Basic" then | 349 if auth_type == "Basic" then |
| 348 local creds = base64.decode(auth_data); | 350 local creds = base64.decode(auth_data); |
| 349 if not creds then return; end | 351 if not creds then return; end |
