Mercurial > prosody-hg
comparison plugins/mod_http_file_share.lua @ 11322:4ade9810ce35
mod_http_file_share: Move Authorization type string
It belongs with the header more than the token itself
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 27 Jan 2021 17:34:48 +0100 |
| parents | 15ab878a7d23 |
| children | a853a018eede |
comparison
equal
deleted
inserted
replaced
| 11321:15ab878a7d23 | 11322:4ade9810ce35 |
|---|---|
| 81 | 81 |
| 82 return true; | 82 return true; |
| 83 end | 83 end |
| 84 | 84 |
| 85 function get_authz(uploader, filename, filesize, filetype, slot) | 85 function get_authz(uploader, filename, filesize, filetype, slot) |
| 86 return "Bearer "..jwt.sign(secret, { | 86 return jwt.sign(secret, { |
| 87 sub = uploader; | 87 sub = uploader; |
| 88 filename = filename; | 88 filename = filename; |
| 89 filesize = filesize; | 89 filesize = filesize; |
| 90 filetype = filetype; | 90 filetype = filetype; |
| 91 slot = slot; | 91 slot = slot; |
| 136 | 136 |
| 137 local reply = st.reply(stanza) | 137 local reply = st.reply(stanza) |
| 138 :tag("slot", { xmlns = namespace }) | 138 :tag("slot", { xmlns = namespace }) |
| 139 :tag("get", { url = slot_url }):up() | 139 :tag("get", { url = slot_url }):up() |
| 140 :tag("put", { url = upload_url }) | 140 :tag("put", { url = upload_url }) |
| 141 :text_tag("header", authz, {name="Authorization"}) | 141 :text_tag("header", "Bearer "..authz, {name="Authorization"}) |
| 142 :reset(); | 142 :reset(); |
| 143 | 143 |
| 144 origin.send(reply); | 144 origin.send(reply); |
| 145 return true; | 145 return true; |
| 146 end | 146 end |
