Software /
code /
verse
Comparison
util/sasl/oauthbearer.lua @ 496:c4ae7aa2958a
util.sasl.oauthbearer: Fix message syntax
Each key-value pair has a \001 trailer, and then the whole thing has a
\001 trailer as well, so it should always end with two \001.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 23 Jun 2023 10:11:25 +0200 |
parent | 477:b0a8d4e9934e |
child | 498:50d0bd035bb7 |
comparison
equal
deleted
inserted
replaced
495:1ca531495c3d | 496:c4ae7aa2958a |
---|---|
1 | 1 |
2 return function (stream, name) | 2 return function (stream, name) |
3 if name == "OAUTHBEARER" and stream.username then | 3 if name == "OAUTHBEARER" and stream.username then |
4 return function (stream) | 4 return function (stream) |
5 local auth = stream.bearer_token and ("Bearer "..stream.bearer_token) or ""; | 5 local auth = stream.bearer_token and ("Bearer "..stream.bearer_token) or ""; |
6 local message, data = coroutine.yield("n,a="..stream.username.."@"..stream.host..",\001auth="..auth.."\001"); | 6 local message, data = coroutine.yield("n,a="..stream.username.."@"..stream.host..",\001auth="..auth.."\001\001"); |
7 if message == "success" then | 7 if message == "success" then |
8 return true; | 8 return true; |
9 elseif message == "challenge" then | 9 elseif message == "challenge" then |
10 stream:event("oauth-failure", { | 10 stream:event("oauth-failure", { |
11 json = data; | 11 json = data; |