bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/methods/validateAuthToken.js
Anton Georgiev 8d52dc1b40 Merge branch 'join-components-with-skeleton' of github.com:perroned/bigbluebutton into router-merging
Conflicts:
	bigbluebutton-html5/imports/api/chat/server/methods/sendChatMessagetoServer.js
	bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeetingToCollection.js
	bigbluebutton-html5/imports/api/polls/server/methods/publishVoteMessage.js
	bigbluebutton-html5/imports/api/slides/server/modifiers/clearSlidesCollection.js
	bigbluebutton-html5/imports/api/users/server/methods/muteUser.js
	bigbluebutton-html5/imports/api/users/server/methods/setUserPresenter.js
	bigbluebutton-html5/imports/api/users/server/methods/unmuteUser.js
	bigbluebutton-html5/imports/api/users/server/methods/userSetEmoji.js
	bigbluebutton-html5/imports/api/users/server/methods/validateAuthToken.js
	bigbluebutton-html5/imports/startup/server/eventHandlers.js
	bigbluebutton-html5/imports/ui/components/app/AppService.js
2016-05-16 19:54:51 +00:00

35 lines
1.2 KiB
JavaScript
Executable File

import { logger } from '/imports/startup/server/logger';
import { redisConfig } from '/config';
import { createDummyUser } from '/imports/api/users/server/modifiers/createDummyUser';
import { publish } from '/imports/startup/server/helpers';
Meteor.methods({
// Construct and send a message to bbb-web to validate the user
validateAuthToken(credentials) {
const { meetingId, requesterUserId, requesterToken } = credentials;
logger.info('sending a validate_auth_token with', {
userid: requesterUserId,
authToken: requesterToken,
meetingid: meetingId,
});
let message = {
payload: {
auth_token: requesterToken,
userid: requesterUserId,
meeting_id: meetingId,
},
header: {
timestamp: new Date().getTime(),
reply_to: `${meetingId}/${requesterUserId}`,
name: 'validate_auth_token',
},
};
if ((requesterToken != null) && (requesterUserId != null) && (meetingId != null)) {
createDummyUser(meetingId, requesterUserId, requesterToken);
return publish(redisConfig.channels.toBBBApps.meeting, message);
} else {
return logger.info('did not have enough information to send a validate_auth_token message');
}
},
});