Comparison

plugins/mod_http_file_share.lua @ 11502:8fd760c04cdf

mod_http_file_share: Include time of issuance in auth token In case an external upload service wants to have the original creation time, or calculate the token expiry itself.
author Kim Alvefur <zash@zash.se>
date Mon, 05 Apr 2021 17:16:18 +0200
parent 11501:2c9db2278fed
child 11503:7adda14945ad
comparison
equal deleted inserted replaced
11501:2c9db2278fed 11502:8fd760c04cdf
131 131
132 return true; 132 return true;
133 end 133 end
134 134
135 function get_authz(slot, uploader, filename, filesize, filetype) 135 function get_authz(slot, uploader, filename, filesize, filetype)
136 local now = os.time();
136 return jwt.sign(secret, { 137 return jwt.sign(secret, {
137 -- token properties 138 -- token properties
138 sub = uploader; 139 sub = uploader;
139 exp = os.time()+300; 140 iat = now;
141 exp = now+300;
140 142
141 -- slot properties 143 -- slot properties
142 slot = slot; 144 slot = slot;
143 -- file properties 145 -- file properties
144 filename = filename; 146 filename = filename;