mod_auth_token: Add semicolons
Remove unnecessary cjson config
This commit is contained in:
parent
84834dc4e6
commit
bb56ea4b33
|
@ -1,13 +1,12 @@
|
||||||
-- Token authentication
|
-- Token authentication
|
||||||
-- Copyright (C) 2015 Atlassian
|
-- Copyright (C) 2015 Atlassian
|
||||||
|
|
||||||
local basexx = require 'basexx';
|
local basexx = require "basexx";
|
||||||
local have_async, async = pcall(require, "util.async");
|
local have_async, async = pcall(require, "util.async");
|
||||||
local formdecode = require "util.http".formdecode;
|
local formdecode = require "util.http".formdecode;
|
||||||
local generate_uuid = require "util.uuid".generate;
|
local generate_uuid = require "util.uuid".generate;
|
||||||
local http = require "net.http";
|
local http = require "net.http";
|
||||||
local json = require 'cjson'
|
local json = require "cjson";
|
||||||
json.encode_empty_table('array')
|
|
||||||
local new_sasl = require "util.sasl".new;
|
local new_sasl = require "util.sasl".new;
|
||||||
local sasl = require "util.sasl";
|
local sasl = require "util.sasl";
|
||||||
local timer = require "util.timer";
|
local timer = require "util.timer";
|
||||||
|
@ -54,7 +53,7 @@ module:hook("bosh-session", function(event)
|
||||||
if query ~= nil then
|
if query ~= nil then
|
||||||
session.auth_token = query and formdecode(query).token or nil;
|
session.auth_token = query and formdecode(query).token or nil;
|
||||||
end
|
end
|
||||||
end)
|
end);
|
||||||
|
|
||||||
function provider.test_password(username, password)
|
function provider.test_password(username, password)
|
||||||
return nil, "Password based auth not supported";
|
return nil, "Password based auth not supported";
|
||||||
|
@ -142,10 +141,10 @@ function provider.get_sasl_handler(session)
|
||||||
|
|
||||||
local pubKey;
|
local pubKey;
|
||||||
if asapKeyServer and session.auth_token ~= nil then
|
if asapKeyServer and session.auth_token ~= nil then
|
||||||
local dotFirst = session.auth_token:find("%.")
|
local dotFirst = session.auth_token:find("%.");
|
||||||
if not dotFirst then return nil, "Invalid token" end
|
if not dotFirst then return nil, "Invalid token" end
|
||||||
local header = json.decode(basexx.from_url64(session.auth_token:sub(1,dotFirst-1)))
|
local header = json.decode(basexx.from_url64(session.auth_token:sub(1,dotFirst-1)));
|
||||||
local kid = header["kid"]
|
local kid = header["kid"];
|
||||||
if kid == nil then
|
if kid == nil then
|
||||||
return false, "not-allowed", "'kid' claim is missing";
|
return false, "not-allowed", "'kid' claim is missing";
|
||||||
end
|
end
|
||||||
|
@ -167,7 +166,7 @@ function provider.get_sasl_handler(session)
|
||||||
session.jitsi_meet_room = claims["room"];
|
session.jitsi_meet_room = claims["room"];
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false, "not-allowed", msg
|
return false, "not-allowed", msg;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -186,10 +185,10 @@ local function anonymous(self, message)
|
||||||
self.username = username;
|
self.username = username;
|
||||||
|
|
||||||
if result == true then
|
if result == true then
|
||||||
return "success"
|
return "success";
|
||||||
else
|
else
|
||||||
|
|
||||||
return "failure", err, msg
|
return "failure", err, msg;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue