5d1fb4c168
The client sends a 'validate_auth_token_request' to the server, that waits a 'validate_auth_token_reply' response from bbb-apps to pass to the client. Still have to get info from /api/enter, for now the meetingId and userId are hard-coded in the client (AuthenticationModel).
36 lines
1.2 KiB
CoffeeScript
Executable File
36 lines
1.2 KiB
CoffeeScript
Executable File
config = require '../config'
|
|
log = require './bbblogger'
|
|
|
|
moduleDeps = ["MessageBus", "ClientProxy"]
|
|
|
|
module.exports = class Controller
|
|
|
|
constructor: ->
|
|
config.modules.wait moduleDeps, =>
|
|
@messageBus = config.modules.get("MessageBus")
|
|
@clientProxy = config.modules.get("ClientProxy")
|
|
|
|
@messageBus.receiveMessages (data) =>
|
|
@processReceivedMessage(data)
|
|
|
|
processReceivedMessage: (data, callback) ->
|
|
@clientProxy.sendToClients(data, callback)
|
|
|
|
# Processes a message requesting authentication
|
|
processAuthMessage: (data, callback) ->
|
|
log.info({ data: data }, "Sending an authentication request and waiting for reply")
|
|
@messageBus.sendAndWaitForReply data, (err, result) ->
|
|
if err?
|
|
log.error({ reason: err, result: result, original: data }, "Authentication failure")
|
|
callback(err, null)
|
|
else
|
|
if result.payload?.valid
|
|
log.info({ result: result }, "Authentication successful")
|
|
callback(null, result)
|
|
else
|
|
log.info({ result: result }, "Authentication failure")
|
|
callback(new Error("Authentication failure"), null)
|
|
|
|
# processEndMessage: (data, callback) ->
|
|
# @clientProxy.endMeeting()
|