function Util:verify_room()

in resources/prosody-plugins/token/util.lib.lua [334:435]


function Util:verify_room(session, room_address)
    if self.allowEmptyToken and session.auth_token == nil then
        module:log(
            "debug",
            "Skipped room token verification - empty tokens are allowed");
        return true;
    end

    
    local room,_,_ = jid.split(room_address);
    if room == nil then
        log("error",
            "Unable to get name of the MUC room ? to: %s", room_address);
        return true;
    end

    local auth_room = session.jitsi_meet_room;
    if auth_room then
        auth_room = string.lower(auth_room);
    end
    if not self.enableDomainVerification then
        
        
        if auth_room and room ~= auth_room and auth_room ~= '*' then
            return false;
        end

        return true;
    end

    local room_address_to_verify = jid.bare(room_address);
    local room_node = jid.node(room_address);
    
    
    local target_subdomain, target_room = extract_subdomain(room_node);

    
    
    
    local room_to_check;
    if auth_room == '*' then
        
        
        if target_room ~= nil then
            
            room_to_check = target_room;
        else
            
            
            room_to_check = room_node;
        end
    else
        
        if session.jitsi_meet_context_room and (session.jitsi_meet_context_room["regex"] == true or session.jitsi_meet_context_room["regex"] == "true") then
            if target_room ~= nil then
                
                room_to_check = target_room:match(auth_room);
            else
                room_to_check = room_node:match(auth_room);
            end
        else
            
            room_to_check = auth_room;
        end
        module:log("debug", "room to check: %s", room_to_check)
        if not room_to_check then
            return false
        end
    end

    local auth_domain = string.lower(session.jitsi_meet_domain);
    local subdomain_to_check;
    if target_subdomain then
        if auth_domain == '*' then
            
            subdomain_to_check = target_subdomain;
        else
            
            subdomain_to_check = auth_domain;
        end
        
        
        if not self.muc_domain_base then
            module:log("warn", "No 'muc_domain_base' option set, denying access!");
            return false;
        end

        return room_address_to_verify == jid.join(
            "["..subdomain_to_check.."]"..room_to_check, self.muc_domain);
    else
        if auth_domain == '*' then
            
            subdomain_to_check = self.muc_domain;
        else
            
            subdomain_to_check = self.muc_domain_prefix.."."..auth_domain;
        end
        
        
        return room_address_to_verify == jid.join(room_to_check, subdomain_to_check);
    end
end