bigbluebutton-Github/bigbluebutton-html5/imports/startup/server/methods/validateAuthToken.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-05-05 02:29:43 +08:00
import { logger } from '/imports/startup/server/logger';
2016-05-02 22:48:20 +08:00
import { redisConfig } from '/config';
2016-05-05 02:29:43 +08:00
import { createDummyUser } from '/imports/startup/server/collection_methods/users';
import { publish } from '/imports/startup/server/redispubsub';
2016-05-02 22:48:20 +08:00
Meteor.methods({
// Construct and send a message to bbb-web to validate the user
validateAuthToken(meetingId, userId, authToken) {
let message;
logger.info('sending a validate_auth_token with', {
userid: userId,
authToken: authToken,
meetingid: meetingId,
});
message = {
payload: {
auth_token: authToken,
userid: userId,
meeting_id: meetingId,
},
header: {
timestamp: new Date().getTime(),
reply_to: `${meetingId}/${userId}`,
name: 'validate_auth_token',
},
};
if ((authToken != null) && (userId != null) && (meetingId != null)) {
createDummyUser(meetingId, userId, authToken);
return publish(redisConfig.channels.toBBBApps.meeting, message);
} else {
return logger.info('did not have enough information to send a validate_auth_token message');
}
},
});