Explorar el Código

mod_auth_token: Add semicolons

Remove unnecessary cjson config
master
Sam Whited hace 8 años
padre
commit
bb56ea4b33
Se han modificado 1 ficheros con 9 adiciones y 10 borrados
  1. 9
    10
      prosody-plugins/mod_auth_token.lua

+ 9
- 10
prosody-plugins/mod_auth_token.lua Ver fichero

@@ -1,13 +1,12 @@
1 1
 -- Token authentication
2 2
 -- Copyright (C) 2015 Atlassian
3 3
 
4
-local basexx = require 'basexx';
4
+local basexx = require "basexx";
5 5
 local have_async, async = pcall(require, "util.async");
6 6
 local formdecode = require "util.http".formdecode;
7 7
 local generate_uuid = require "util.uuid".generate;
8 8
 local http = require "net.http";
9
-local json = require 'cjson'
10
-json.encode_empty_table('array')
9
+local json = require "cjson";
11 10
 local new_sasl = require "util.sasl".new;
12 11
 local sasl = require "util.sasl";
13 12
 local timer = require "util.timer";
@@ -54,7 +53,7 @@ module:hook("bosh-session", function(event)
54 53
 	if query ~= nil then
55 54
 		session.auth_token = query and formdecode(query).token or nil;
56 55
 	end
57
-end)
56
+end);
58 57
 
59 58
 function provider.test_password(username, password)
60 59
 	return nil, "Password based auth not supported";
@@ -142,10 +141,10 @@ function provider.get_sasl_handler(session)
142 141
 
143 142
 		local pubKey;
144 143
 		if asapKeyServer and session.auth_token ~= nil then
145
-			local dotFirst = session.auth_token:find("%.")
144
+			local dotFirst = session.auth_token:find("%.");
146 145
 			if not dotFirst then return nil, "Invalid token" end
147
-			local header = json.decode(basexx.from_url64(session.auth_token:sub(1,dotFirst-1)))
148
-			local kid = header["kid"]
146
+			local header = json.decode(basexx.from_url64(session.auth_token:sub(1,dotFirst-1)));
147
+			local kid = header["kid"];
149 148
 			if kid == nil then
150 149
 				return false, "not-allowed", "'kid' claim is missing";
151 150
 			end
@@ -167,7 +166,7 @@ function provider.get_sasl_handler(session)
167 166
 			session.jitsi_meet_room = claims["room"];
168 167
 			return true;
169 168
 		else
170
-			return false, "not-allowed", msg
169
+			return false, "not-allowed", msg;
171 170
 		end
172 171
 	end
173 172
 
@@ -186,10 +185,10 @@ local function anonymous(self, message)
186 185
 	self.username = username;
187 186
 
188 187
 	if result == true then
189
-		return "success"
188
+		return "success";
190 189
 	else
191 190
 
192
-		return "failure", err, msg
191
+		return "failure", err, msg;
193 192
 	end
194 193
 end
195 194
 

Loading…
Cancelar
Guardar