- send validate conn token
This commit is contained in:
parent
4e8f2abbb3
commit
06e974847e
@ -0,0 +1,33 @@
|
||||
package org.bigbluebutton.core.apps.meeting
|
||||
|
||||
import org.bigbluebutton.common2.msgs.ValidateConnAuthTokenSysMsg
|
||||
import org.bigbluebutton.core.models.RegisteredUsers
|
||||
import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter }
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
|
||||
trait ValidateConnAuthTokenSysMsgHdlr {
|
||||
val liveMeeting: LiveMeeting
|
||||
val outGW: OutMsgRouter
|
||||
|
||||
def handleValidateConnAuthTokenSysMsg(msg: ValidateConnAuthTokenSysMsg): Unit = {
|
||||
|
||||
println("******************** RECEIVED ValidateConnAuthTokenSysMsg")
|
||||
|
||||
val regUser = RegisteredUsers.getRegisteredUserWithToken(
|
||||
msg.body.authToken,
|
||||
msg.body.userId,
|
||||
liveMeeting.registeredUsers
|
||||
)
|
||||
|
||||
regUser match {
|
||||
case Some(u) =>
|
||||
val event = MsgBuilder.buildValidateConnAuthTokenSysRespMsg(msg.body.meetingId, msg.body.userId,
|
||||
msg.body.authToken, true, msg.body.conn)
|
||||
outGW.send(event)
|
||||
case None =>
|
||||
val event = MsgBuilder.buildValidateConnAuthTokenSysRespMsg(msg.body.meetingId, msg.body.userId,
|
||||
msg.body.authToken, false, msg.body.conn)
|
||||
outGW.send(event)
|
||||
}
|
||||
}
|
||||
}
|
@ -298,7 +298,7 @@ class ReceivedJsonMsgHandlerActor(
|
||||
routeGenericMsg[CreateGroupChatReqMsg](envelope, jsonNode)
|
||||
|
||||
case ValidateConnAuthTokenSysMsg.NAME =>
|
||||
println("************** RECEIVED ValidateConnAuthTokenSysMsg.NAME")
|
||||
println("\n\n************** RECEIVED ValidateConnAuthTokenSysMsg.NAME !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n")
|
||||
routeGenericMsg[ValidateConnAuthTokenSysMsg](envelope, jsonNode)
|
||||
|
||||
case _ =>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.bigbluebutton.core.running
|
||||
|
||||
import java.io.{ PrintWriter, StringWriter }
|
||||
|
||||
import akka.actor._
|
||||
import akka.actor.SupervisorStrategy.Resume
|
||||
import org.bigbluebutton.core.apps.groupchats.{ GroupChatApp, GroupChatHdlrs }
|
||||
@ -28,10 +29,11 @@ import org.bigbluebutton.common2.msgs._
|
||||
import org.bigbluebutton.core.apps.breakout._
|
||||
import org.bigbluebutton.core.apps.polls._
|
||||
import org.bigbluebutton.core.apps.voice._
|
||||
|
||||
import scala.concurrent.duration._
|
||||
import org.bigbluebutton.core2.testdata.FakeTestData
|
||||
import org.bigbluebutton.core.apps.layout.LayoutApp2x
|
||||
import org.bigbluebutton.core.apps.meeting.SyncGetMeetingInfoRespMsgHdlr
|
||||
import org.bigbluebutton.core.apps.meeting.{ SyncGetMeetingInfoRespMsgHdlr, ValidateConnAuthTokenSysMsgHdlr }
|
||||
import org.bigbluebutton.core.apps.users.ChangeLockSettingsInMeetingCmdMsgHdlr
|
||||
import org.bigbluebutton.core2.message.senders.MsgBuilder
|
||||
|
||||
@ -76,7 +78,8 @@ class MeetingActor(
|
||||
with SendBreakoutTimeRemainingMsgHdlr
|
||||
with ChangeLockSettingsInMeetingCmdMsgHdlr
|
||||
with SyncGetMeetingInfoRespMsgHdlr
|
||||
with ClientToServerLatencyTracerMsgHdlr {
|
||||
with ClientToServerLatencyTracerMsgHdlr
|
||||
with ValidateConnAuthTokenSysMsgHdlr {
|
||||
|
||||
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
|
||||
case e: Exception => {
|
||||
@ -342,6 +345,8 @@ class MeetingActor(
|
||||
case m: GetGroupChatsReqMsg => state = groupChatApp.handle(m, state, liveMeeting, msgBus)
|
||||
case m: SendGroupChatMessageMsg => state = groupChatApp.handle(m, state, liveMeeting, msgBus)
|
||||
|
||||
case m: ValidateConnAuthTokenSysMsg => handleValidateConnAuthTokenSysMsg(m)
|
||||
|
||||
case _ => log.warning("***** Cannot handle " + msg.envelope.name)
|
||||
}
|
||||
}
|
||||
|
@ -63,6 +63,16 @@ object MsgBuilder {
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
def buildValidateConnAuthTokenSysRespMsg(meetingId: String, userId: String, authToken: String,
|
||||
authzed: Boolean, conn: String): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId)
|
||||
val envelope = BbbCoreEnvelope(ValidateConnAuthTokenSysRespMsg.NAME, routing)
|
||||
val header = BbbCoreHeaderWithMeetingId(ValidateConnAuthTokenSysRespMsg.NAME, meetingId)
|
||||
val body = ValidateConnAuthTokenSysRespMsgBody(meetingId, userId, authToken, conn, authzed)
|
||||
val event = ValidateConnAuthTokenSysRespMsg(header, body)
|
||||
BbbCommonEnvCoreMsg(envelope, event)
|
||||
}
|
||||
|
||||
def buildValidateAuthTokenRespMsg(meetingId: String, userId: String, authToken: String,
|
||||
valid: Boolean, waitForApproval: Boolean): BbbCommonEnvCoreMsg = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId)
|
||||
|
@ -3,7 +3,7 @@ name := "bbb-apps-common"
|
||||
|
||||
organization := "org.bigbluebutton"
|
||||
|
||||
version := "0.0.2"
|
||||
version := "0.0.3-SNAPSHOT"
|
||||
|
||||
scalaVersion := "2.12.2"
|
||||
|
||||
|
@ -73,22 +73,22 @@ class ClientGWApplication(val msgToClientGW: MsgToClientGW,
|
||||
*/
|
||||
|
||||
def connect(connInfo: ConnInfo): Unit = {
|
||||
log.debug("**** ClientGWApplication connect " + connInfo)
|
||||
//log.debug("**** ClientGWApplication connect " + connInfo)
|
||||
msgFromClientEventBus.publish(MsgFromClientBusMsg(fromClientChannel, new ConnectMsg(connInfo)))
|
||||
}
|
||||
|
||||
def disconnect(connInfo: ConnInfo): Unit = {
|
||||
log.debug("**** ClientGWApplication disconnect " + connInfo)
|
||||
//log.debug("**** ClientGWApplication disconnect " + connInfo)
|
||||
msgFromClientEventBus.publish(MsgFromClientBusMsg(fromClientChannel, new DisconnectMsg(connInfo)))
|
||||
}
|
||||
|
||||
def handleMsgFromClient(connInfo: ConnInfo, json: String): Unit = {
|
||||
log.debug("**** ClientGWApplication handleMsgFromClient " + json)
|
||||
//log.debug("**** ClientGWApplication handleMsgFromClient " + json)
|
||||
msgFromClientEventBus.publish(MsgFromClientBusMsg(fromClientChannel, new MsgFromClientMsg(connInfo, json)))
|
||||
}
|
||||
|
||||
def send(channel: String, json: String): Unit = {
|
||||
log.debug("Sending message {}", json)
|
||||
//log.debug("Sending message {}", json)
|
||||
jsonMsgToAkkaAppsBus.publish(JsonMsgToAkkaAppsBusMsg(toAkkaAppsJsonChannel, new JsonMsgToSendToAkkaApps(channel, json)))
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ class ReceivedJsonMsgHdlrActor(val msgFromAkkaAppsEventBus: MsgFromAkkaAppsEvent
|
||||
}
|
||||
|
||||
def handleReceivedJsonMessage(msg: JsonMsgFromAkkaApps): Unit = {
|
||||
log.debug("****** Received JSON msg " + msg.data)
|
||||
//log.debug("****** Received JSON msg " + msg.data)
|
||||
JsonUtil.fromJson[BbbCommonEnvJsNodeMsg](msg.data) match {
|
||||
case Success(m) => msgFromAkkaAppsEventBus.publish(MsgFromAkkaApps(fromAkkaAppsChannel, m))
|
||||
case Failure(ex) => log.error("Failed to deserialize message " + ex)
|
||||
|
@ -49,7 +49,7 @@ class AppsRedisSubscriberActor(jsonMsgBus: JsonMsgFromAkkaAppsBus, oldMessageEve
|
||||
def onMessage(message: Message) {
|
||||
//log.error(s"SHOULD NOT BE RECEIVING: $message")
|
||||
if (channels.contains(message.channel)) {
|
||||
log.debug(s"RECEIVED:\n ${message.data.utf8String} \n")
|
||||
//log.debug(s"RECEIVED:\n ${message.data.utf8String} \n")
|
||||
val receivedJsonMessage = new JsonMsgFromAkkaApps(message.channel, message.data.utf8String)
|
||||
jsonMsgBus.publish(JsonMsgFromAkkaAppsEvent(fromAkkaAppsJsonChannel, receivedJsonMessage))
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class RedisPublisher(val system: ActorSystem) extends SystemConfiguration {
|
||||
redis.clientSetname("Red5AppsPub")
|
||||
|
||||
def publish(channel: String, data: String) {
|
||||
log.debug("PUBLISH TO [" + channel + "]: \n [" + data + "]")
|
||||
//log.debug("PUBLISH TO [" + channel + "]: \n [" + data + "]")
|
||||
redis.publish(channel, ByteString(data))
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv
|
||||
}
|
||||
|
||||
def handleConnectMsg(msg: ConnectMsg): Unit = {
|
||||
log.debug("**** MeetingActor handleConnectMsg " + msg.connInfo.meetingId)
|
||||
//log.debug("**** MeetingActor handleConnectMsg " + msg.connInfo.meetingId)
|
||||
UsersManager.findWithId(userMgr, msg.connInfo.userId) match {
|
||||
case Some(m) => m.actorRef forward(msg)
|
||||
case None =>
|
||||
@ -42,7 +42,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv
|
||||
}
|
||||
|
||||
def handleDisconnectMsg(msg: DisconnectMsg): Unit = {
|
||||
log.debug("**** MeetingActor handleDisconnectMsg " + msg.connInfo.meetingId)
|
||||
//log.debug("**** MeetingActor handleDisconnectMsg " + msg.connInfo.meetingId)
|
||||
for {
|
||||
m <- UsersManager.findWithId(userMgr, msg.connInfo.userId)
|
||||
} yield {
|
||||
@ -51,7 +51,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv
|
||||
}
|
||||
|
||||
def handleMsgFromClientMsg(msg: MsgFromClientMsg):Unit = {
|
||||
log.debug("**** MeetingActor handleMsgFromClient " + msg.json)
|
||||
//log.debug("**** MeetingActor handleMsgFromClient " + msg.json)
|
||||
for {
|
||||
m <- UsersManager.findWithId(userMgr, msg.connInfo.userId)
|
||||
} yield {
|
||||
@ -60,7 +60,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv
|
||||
}
|
||||
|
||||
def handleBbbServerMsg(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingActor handleBbbServerMsg " + msg.envelope.name)
|
||||
//log.debug("**** MeetingActor handleBbbServerMsg " + msg.envelope.name)
|
||||
for {
|
||||
msgType <- msg.envelope.routing.get("msgType")
|
||||
} yield {
|
||||
@ -69,7 +69,7 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv
|
||||
}
|
||||
|
||||
def handleServerMsg(msgType: String, msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingActor handleServerMsg " + msg.envelope.name)
|
||||
//log.debug("**** MeetingActor handleServerMsg " + msg.envelope.name)
|
||||
msgType match {
|
||||
case MessageTypes.DIRECT => handleDirectMessage(msg)
|
||||
case MessageTypes.BROADCAST_TO_MEETING => handleBroadcastMessage(msg)
|
||||
@ -78,18 +78,18 @@ class MeetingActor(val meetingId: String, msgToAkkaAppsEventBus: MsgToAkkaAppsEv
|
||||
}
|
||||
|
||||
private def forwardToUser(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingActor forwardToUser " + msg.envelope.name)
|
||||
//log.debug("**** MeetingActor forwardToUser " + msg.envelope.name)
|
||||
for {
|
||||
userId <- msg.envelope.routing.get("userId")
|
||||
m <- UsersManager.findWithId(userMgr, userId)
|
||||
} yield {
|
||||
log.debug("**** MeetingActor forwardToUser " + m.userId)
|
||||
//log.debug("**** MeetingActor forwardToUser " + m.userId)
|
||||
m.actorRef forward(msg)
|
||||
}
|
||||
}
|
||||
|
||||
def handleDirectMessage(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingActor handleDirectMessage " + msg.envelope.name)
|
||||
//log.debug("**** MeetingActor handleDirectMessage " + msg.envelope.name)
|
||||
// In case we want to handle specific messages. We can do it here.
|
||||
forwardToUser(msg)
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus,
|
||||
}
|
||||
|
||||
def handleConnectMsg(msg: ConnectMsg): Unit = {
|
||||
log.debug("****** Received handleConnectMsg " + msg)
|
||||
//log.debug("****** Received handleConnectMsg " + msg)
|
||||
MeetingManager.findWithMeetingId(meetingMgr, msg.connInfo.meetingId) match {
|
||||
case Some(m) => m.actorRef forward(msg)
|
||||
case None =>
|
||||
@ -41,7 +41,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus,
|
||||
}
|
||||
|
||||
def handleDisconnectMsg(msg: DisconnectMsg): Unit = {
|
||||
log.debug("****** Received handleDisconnectMsg " + msg)
|
||||
//log.debug("****** Received handleDisconnectMsg " + msg)
|
||||
for {
|
||||
m <- MeetingManager.findWithMeetingId(meetingMgr, msg.connInfo.meetingId)
|
||||
} yield {
|
||||
@ -50,7 +50,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus,
|
||||
}
|
||||
|
||||
def handleMsgFromClientMsg(msg: MsgFromClientMsg):Unit = {
|
||||
log.debug("**** MeetingManagerActor handleMsgFromClient " + msg.json)
|
||||
//log.debug("**** MeetingManagerActor handleMsgFromClient " + msg.json)
|
||||
for {
|
||||
m <- MeetingManager.findWithMeetingId(meetingMgr, msg.connInfo.meetingId)
|
||||
} yield {
|
||||
@ -59,7 +59,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus,
|
||||
}
|
||||
|
||||
def handleBbbServerMsg(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingManagerActor handleBbbServerMsg " + msg.envelope.name)
|
||||
//log.debug("**** MeetingManagerActor handleBbbServerMsg " + msg.envelope.name)
|
||||
for {
|
||||
msgType <- msg.envelope.routing.get("msgType")
|
||||
} yield {
|
||||
@ -68,7 +68,7 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus,
|
||||
}
|
||||
|
||||
def handleServerMsg(msgType: String, msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingManagerActor handleServerMsg " + msg.envelope.name)
|
||||
//log.debug("**** MeetingManagerActor handleServerMsg " + msg.envelope.name)
|
||||
msgType match {
|
||||
case MessageTypes.DIRECT => handleDirectMessage(msg)
|
||||
case MessageTypes.BROADCAST_TO_MEETING => handleBroadcastMessage(msg)
|
||||
@ -78,10 +78,10 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus,
|
||||
|
||||
private def forwardToMeeting(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
msg.envelope.routing.get("meetingId") match {
|
||||
case Some(meetingId2) => log.debug("**** MeetingManagerActor forwardToMeeting. Found " + meetingId2)
|
||||
case Some(meetingId2) => //log.debug("**** MeetingManagerActor forwardToMeeting. Found " + meetingId2)
|
||||
MeetingManager.findWithMeetingId(meetingMgr, meetingId2) match {
|
||||
case Some(meetingId2) => log.debug("**** MeetingManagerActor forwardToMeeting. Found " + meetingId2.meetingId)
|
||||
case None => log.debug("**** MeetingManagerActor forwardToMeeting. Could not find meetingId")
|
||||
case Some(meetingId2) => //log.debug("**** MeetingManagerActor forwardToMeeting. Found " + meetingId2.meetingId)
|
||||
case None => //log.debug("**** MeetingManagerActor forwardToMeeting. Could not find meetingId")
|
||||
}
|
||||
case None => log.debug("**** MeetingManagerActor forwardToMeeting. Could not find meetingId")
|
||||
}
|
||||
@ -92,25 +92,25 @@ class MeetingManagerActor(msgToAkkaAppsEventBus: MsgToAkkaAppsEventBus,
|
||||
meetingId <- msg.envelope.routing.get("meetingId")
|
||||
m <- MeetingManager.findWithMeetingId(meetingMgr, meetingId)
|
||||
} yield {
|
||||
log.debug("**** MeetingManagerActor forwardToMeeting. " + m.meetingId)
|
||||
//log.debug("**** MeetingManagerActor forwardToMeeting. " + m.meetingId)
|
||||
m.actorRef forward(msg)
|
||||
}
|
||||
}
|
||||
|
||||
def handleDirectMessage(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingManagerActor handleDirectMessage " + msg.envelope.name)
|
||||
//log.debug("**** MeetingManagerActor handleDirectMessage " + msg.envelope.name)
|
||||
// In case we want to handle specific message. We can do it here.
|
||||
forwardToMeeting(msg)
|
||||
}
|
||||
|
||||
def handleBroadcastMessage(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingManagerActor handleBroadcastMessage " + msg.envelope.name)
|
||||
// log.debug("**** MeetingManagerActor handleBroadcastMessage " + msg.envelope.name)
|
||||
// In case we want to handle specific message. We can do it here.
|
||||
forwardToMeeting(msg)
|
||||
}
|
||||
|
||||
def handleSystemMessage(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** MeetingManagerActor handleSystemMessage " + msg.envelope.name)
|
||||
//log.debug("**** MeetingManagerActor handleSystemMessage " + msg.envelope.name)
|
||||
// In case we want to handle specific message. We can do it here.
|
||||
forwardToMeeting(msg)
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ class UserActor(val userId: String,
|
||||
}
|
||||
|
||||
def handleBbbServerMsg(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** UserActor handleBbbServerMsg " + msg)
|
||||
//log.debug("**** UserActor handleBbbServerMsg " + msg)
|
||||
for {
|
||||
msgType <- msg.envelope.routing.get("msgType")
|
||||
} yield {
|
||||
@ -128,7 +128,7 @@ class UserActor(val userId: String,
|
||||
}
|
||||
|
||||
def handleServerMsg(msgType: String, msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("**** UserActor handleServerMsg " + msg)
|
||||
// log.debug("**** UserActor handleServerMsg " + msg)
|
||||
msgType match {
|
||||
case MessageTypes.DIRECT => handleDirectMessage(msg)
|
||||
case MessageTypes.BROADCAST_TO_MEETING => handleBroadcastMessage(msg)
|
||||
@ -137,7 +137,7 @@ class UserActor(val userId: String,
|
||||
}
|
||||
|
||||
private def forwardToUser(msg: BbbCommonEnvJsNodeMsg): Unit = {
|
||||
log.debug("UserActor forwardToUser. Forwarding to connection. " + msg)
|
||||
//log.debug("UserActor forwardToUser. Forwarding to connection. " + msg)
|
||||
for {
|
||||
conn <- Connections.findActiveConnection(conns)
|
||||
} yield {
|
||||
|
@ -64,7 +64,7 @@ dependencies {
|
||||
providedCompile 'org.apache.commons:commons-lang3:3.6'
|
||||
|
||||
compile 'org.bigbluebutton:bbb-common-message_2.12:0.0.19-SNAPSHOT'
|
||||
compile 'org.bigbluebutton:bbb-apps-common_2.12:0.0.2'
|
||||
compile 'org.bigbluebutton:bbb-apps-common_2.12:0.0.3-SNAPSHOT'
|
||||
}
|
||||
|
||||
test {
|
||||
|
Loading…
Reference in New Issue
Block a user