Mercurial > prosody-modules
comparison mod_http_oauth2/mod_http_oauth2.lua @ 5202:b81fd0d22c66
mod_http_oauth2: Calculate client secret expiry in registration response
Not actually the client_secret that expires, but the client_id JWT.
Returning '0' indicating no expiry was incorrect unless JWT expiry is
turned off, which we check for now.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 04 Mar 2023 17:06:47 +0100 |
| parents | 47576c73eedf |
| children | c60cff787d6a |
comparison
equal
deleted
inserted
replaced
| 5201:47576c73eedf | 5202:b81fd0d22c66 |
|---|---|
| 421 client_id = client_id; | 421 client_id = client_id; |
| 422 client_secret = client_secret; | 422 client_secret = client_secret; |
| 423 client_id_issued_at = os.time(); | 423 client_id_issued_at = os.time(); |
| 424 client_secret_expires_at = 0; | 424 client_secret_expires_at = 0; |
| 425 } | 425 } |
| 426 if not registration_options.accept_expired then | |
| 427 client_desc.client_secret_expires_at = client_desc.client_id_issued_at + (registration_options.default_ttl or 3600); | |
| 428 end | |
| 426 | 429 |
| 427 return { | 430 return { |
| 428 status_code = 201; | 431 status_code = 201; |
| 429 headers = { content_type = "application/json" }; | 432 headers = { content_type = "application/json" }; |
| 430 body = json.encode(client_desc); | 433 body = json.encode(client_desc); |
