浏览代码

Removes not needed parameter token in process_and_verify_token.

master
damencho 8 年前
父节点
当前提交
88a58a057e
共有 2 个文件被更改,包括 6 次插入7 次删除
  1. 1
    3
      resources/prosody-plugins/mod_auth_token.lua
  2. 5
    4
      resources/prosody-plugins/token/util.lib.lua

+ 1
- 3
resources/prosody-plugins/mod_auth_token.lua 查看文件

52
 end
52
 end
53
 
53
 
54
 function provider.get_sasl_handler(session)
54
 function provider.get_sasl_handler(session)
55
-	-- JWT token extracted from BOSH URL
56
-	local token = session.auth_token;
57
 
55
 
58
 	local function get_username_from_token(self, message)
56
 	local function get_username_from_token(self, message)
59
-        return token_util:process_and_verify_token(session, token);
57
+        return token_util:process_and_verify_token(session);
60
 	end
58
 	end
61
 
59
 
62
 	return new_sasl(host, { anonymous = get_username_from_token });
60
 	return new_sasl(host, { anonymous = get_username_from_token });

+ 5
- 4
resources/prosody-plugins/token/util.lib.lua 查看文件

183
 end
183
 end
184
 
184
 
185
 --- Verifies token and process needed values to be stored in the session.
185
 --- Verifies token and process needed values to be stored in the session.
186
+-- Token is obtained from session.auth_token.
186
 -- Stores in session the following values:
187
 -- Stores in session the following values:
187
 -- session.jitsi_meet_room - the room name value from the token
188
 -- session.jitsi_meet_room - the room name value from the token
188
 -- session.jitsi_meet_domain - the domain name value from the token
189
 -- session.jitsi_meet_domain - the domain name value from the token
189
 -- @param session the current session
190
 -- @param session the current session
190
 -- @return false and error
191
 -- @return false and error
191
-function Util:process_and_verify_token(session, token)
192
+function Util:process_and_verify_token(session)
192
 
193
 
193
-    if token == nil then
194
+    if session.auth_token == nil then
194
         if self.allowEmptyToken then
195
         if self.allowEmptyToken then
195
             return true;
196
             return true;
196
         else
197
         else
217
     -- now verify the whole token
217
     -- now verify the whole token
218
     local claims, msg;
218
     local claims, msg;
219
     if self.asapKeyServer then
219
     if self.asapKeyServer then
220
-        claims, msg = self:verify_token(token);
220
+        claims, msg = self:verify_token(session.auth_token);
221
     else
221
     else
222
-        claims, msg = self:verify_token(token);
222
+        claims, msg = self:verify_token(session.auth_token);
223
     end
223
     end
224
     if claims ~= nil then
224
     if claims ~= nil then
225
         -- Binds room name to the session which is later checked on MUC join
225
         -- Binds room name to the session which is later checked on MUC join

正在加载...
取消
保存