Mercurial > prosody-modules
comparison mod_http_oauth2/mod_http_oauth2.lua @ 5419:a0333176303c
mod_http_oauth2: Fix error if no scopes requested
granted_scopes would be nil but the later code expects an array
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 05 May 2023 21:32:34 +0200 |
| parents | f2c7bb3af600 |
| children | aa068449b0b6 |
comparison
equal
deleted
inserted
replaced
| 5418:f2c7bb3af600 | 5419:a0333176303c |
|---|---|
| 131 local function filter_scopes(username, requested_scope_string) | 131 local function filter_scopes(username, requested_scope_string) |
| 132 local granted_scopes, requested_roles; | 132 local granted_scopes, requested_roles; |
| 133 | 133 |
| 134 if requested_scope_string then -- Specific role(s) requested | 134 if requested_scope_string then -- Specific role(s) requested |
| 135 granted_scopes, requested_roles = split_scopes(parse_scopes(requested_scope_string)); | 135 granted_scopes, requested_roles = split_scopes(parse_scopes(requested_scope_string)); |
| 136 else | |
| 137 granted_scopes = array(); | |
| 136 end | 138 end |
| 137 | 139 |
| 138 local selected_role = select_role(username, requested_roles); | 140 local selected_role = select_role(username, requested_roles); |
| 139 granted_scopes:push(selected_role); | 141 granted_scopes:push(selected_role); |
| 140 | 142 |
