- pass token on video connect

This commit is contained in:
Richard Alam 2017-11-01 14:55:48 -07:00
parent 0e8ec5f3b4
commit 4e8f2abbb3
7 changed files with 45 additions and 6 deletions

View File

@ -297,6 +297,10 @@ class ReceivedJsonMsgHandlerActor(
case CreateGroupChatReqMsg.NAME =>
routeGenericMsg[CreateGroupChatReqMsg](envelope, jsonNode)
case ValidateConnAuthTokenSysMsg.NAME =>
println("************** RECEIVED ValidateConnAuthTokenSysMsg.NAME")
routeGenericMsg[ValidateConnAuthTokenSysMsg](envelope, jsonNode)
case _ =>
log.error("Cannot route envelope name " + envelope.name)
// do nothing

View File

@ -129,3 +129,14 @@ object RecordingChapterBreakSysMsg { val NAME = "RecordingChapterBreakSysMsg" }
case class RecordingChapterBreakSysMsg(header: BbbCoreHeaderWithMeetingId,
body: RecordingChapterBreakSysMsgBody) extends BbbCoreMsg
case class RecordingChapterBreakSysMsgBody(meetingId: String, timestamp: Long)
object ValidateConnAuthTokenSysMsg { val NAME = "ValidateConnAuthTokenSysMsg" }
case class ValidateConnAuthTokenSysMsg(header: BbbClientMsgHeader,
body: ValidateConnAuthTokenSysMsgBody) extends StandardMsg
case class ValidateConnAuthTokenSysMsgBody(meetingId: String, userId: String, authToken: String, conn: String)
object ValidateConnAuthTokenSysRespMsg { val NAME = "ValidateConnAuthTokenSysRespMsg" }
case class ValidateConnAuthTokenSysRespMsg(header: BbbCoreHeaderWithMeetingId,
body: ValidateConnAuthTokenSysRespMsgBody) extends BbbCoreMsg
case class ValidateConnAuthTokenSysRespMsgBody(meetingId: String, userId: String,
authToken: String, conn: String, authzed: Boolean)

View File

@ -88,13 +88,18 @@ public class VideoApplication extends MultiThreadedApplicationAdapter {
params = new Object[2];
params[0] = "UNKNOWN-MEETING-ID";
params[1] = "UNKNOWN-USER-ID";
params[2] = "UNKNOWN-AUTH-TOKEN";
}
String meetingId = ((String) params[0]).toString();
String userId = ((String) params[1]).toString();
String authToken = ((String) params[2]).toString();
Red5.getConnectionLocal().setAttribute("MEETING_ID", meetingId);
Red5.getConnectionLocal().setAttribute("USERID", userId);
Red5.getConnectionLocal().setAttribute("AUTH_TOKEN", authToken);
publisher.validateConnAuthToken(meetingId, userId, authToken);
String connType = getConnectionType(Red5.getConnectionLocal().getType());
String sessionId = Red5.getConnectionLocal().getSessionId();

View File

@ -8,6 +8,9 @@ import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import org.bigbluebutton.common2.msgs.BbbClientMsgHeader;
import org.bigbluebutton.common2.msgs.ValidateConnAuthTokenSysMsg;
import org.bigbluebutton.common2.msgs.ValidateConnAuthTokenSysMsgBody;
public class MessagePublisher {
@ -17,6 +20,19 @@ public class MessagePublisher {
this.sender = sender;
}
public void validateConnAuthToken(String meetingId, String userId, String authToken) {
BbbClientMsgHeader header = new BbbClientMsgHeader("ValidateConnAuthTokenSysMsg", meetingId, userId);
ValidateConnAuthTokenSysMsgBody body = new ValidateConnAuthTokenSysMsgBody(meetingId,
userId, authToken, "VIDEO");
ValidateConnAuthTokenSysMsg msg = new ValidateConnAuthTokenSysMsg(header, body);
Gson gson = new Gson();
String json = gson.toJson(msg);
System.out.println("**** SENDING " + json);
sender.send("to-akka-apps-redis-channel", json);
}
// Polling
public void userSharedWebcamMessage(String meetingId, String userId, String streamId) {
UserSharedWebcamMessage msg = new UserSharedWebcamMessage(meetingId, userId, streamId);

View File

@ -79,6 +79,8 @@ public class MessageSender {
public void run() {
Jedis jedis = redisPool.getResource();
try {
System.out.println("**** PUBLISH TO " + channel + " msg=" + message);
jedis.publish(channel, message);
} catch(Exception e){
log.warn("Cannot publish the message to redis", e);

View File

@ -154,7 +154,8 @@ package org.bigbluebutton.main.model
var curTime:Number = new Date().getTime();
// Create connection with the server.
nc.connect( this.baseURI, "portTestMeetingId-" + curTime, "portTestDummyUserId-" + curTime);
nc.connect( this.baseURI, "portTestMeetingId-" + curTime,
"portTestDummyUserId-" + curTime, "portTestDummyToken-" + curTime);
status = "Connecting...";
} catch( e : ArgumentError ) {
// Invalid parameters.

View File

@ -29,14 +29,13 @@ package org.bigbluebutton.modules.videoconf.business
import flash.media.H264VideoStreamSettings;
import flash.net.NetConnection;
import flash.net.NetStream;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.managers.ReconnectionManager;
import org.bigbluebutton.main.api.JSLog;
import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.modules.videoconf.events.ConnectedEvent;
import org.bigbluebutton.modules.videoconf.events.StartBroadcastEvent;
@ -82,7 +81,8 @@ package org.bigbluebutton.modules.videoconf.business
}
public function connect():void {
nc.connect(_url, UsersUtil.getInternalMeetingID(), UsersUtil.getMyUserID());
nc.connect(_url, UsersUtil.getInternalMeetingID(),
UsersUtil.getMyUserID(), LiveMeeting.inst().me.authToken);
}
private function onAsyncError(event:AsyncErrorEvent):void{