Merge branch 'upgrade-to-scala-2.11' of https://github.com/ritzalam/bigbluebutton into upgrade-to-scala-2.11
Conflicts: bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/Red5BBBInGw.java
This commit is contained in:
commit
a0b30d3d4f
@ -42,7 +42,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
|
||||
|
||||
private RecorderApplication recorderApplication;
|
||||
private ConnectionInvokerService connInvokerService;
|
||||
private IBigBlueButtonInGW bbbGW;
|
||||
private IBigBlueButtonInGW bbbGW, red5InGW;
|
||||
|
||||
private final String APP = "BBB";
|
||||
private final String CONN = "RED5-";
|
||||
@ -251,7 +251,7 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
|
||||
String logStr = gson.toJson(logData);
|
||||
|
||||
log.info("User validate token bbb-apps: data={}", logStr);
|
||||
bbbGW.validateAuthToken(meetingId, userId, token, meetingId + "/" + userId, sessionId);
|
||||
red5InGW.validateAuthToken(meetingId, userId, token, meetingId + "/" + userId, sessionId);
|
||||
}
|
||||
|
||||
public void setRecorderApplication(RecorderApplication a) {
|
||||
@ -276,4 +276,9 @@ public class BigBlueButtonApplication extends MultiThreadedApplicationAdapter {
|
||||
public void setBigBlueButtonInGW(IBigBlueButtonInGW bbbGW) {
|
||||
this.bbbGW = bbbGW;
|
||||
}
|
||||
|
||||
public void setRed5InGW(IBigBlueButtonInGW red5InGW) {
|
||||
this.red5InGW = red5InGW;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class MeetingMessageHandler implements MessageHandler {
|
||||
public void handleMessage(String pattern, String channel, String message) {
|
||||
// System.out.println("Checking message: " + pattern + " " + channel + " " + message);
|
||||
if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) {
|
||||
// System.out.println("Meeting message: " + channel + " " + message);
|
||||
System.out.println("Meeting message: " + channel + " " + message);
|
||||
IMessage msg = MessageFromJsonConverter.convert(message);
|
||||
|
||||
if (msg != null) {
|
||||
|
@ -28,7 +28,7 @@ public class MessageFromJsonConverter {
|
||||
System.out.println("Registering a user");
|
||||
return RegisterUserMessage.fromJson(message);
|
||||
case ValidateAuthTokenMessage.VALIDATE_AUTH_TOKEN:
|
||||
return processValidateAuthTokenMessage(header, payload);
|
||||
return ValidateAuthTokenMessage.fromJson(message);
|
||||
case UserConnectedToGlobalAudio.USER_CONNECTED_TO_GLOBAL_AUDIO:
|
||||
return UserConnectedToGlobalAudio.fromJson(message);
|
||||
case UserDisconnectedFromGlobalAudio.USER_DISCONNECTED_FROM_GLOBAL_AUDIO:
|
||||
|
@ -1,5 +1,10 @@
|
||||
package org.bigbluebutton.conference.service.messaging;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class ValidateAuthTokenMessage implements IMessage {
|
||||
public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token";
|
||||
public static final String VERSION = "0.0.1";
|
||||
@ -17,4 +22,44 @@ public class ValidateAuthTokenMessage implements IMessage {
|
||||
this.replyTo = replyTo;
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public String toJson() {
|
||||
HashMap<String, Object> payload = new HashMap<String, Object>();
|
||||
payload.put(Constants.MEETING_ID, meetingId);
|
||||
payload.put(Constants.USER_ID, userId);
|
||||
payload.put(Constants.AUTH_TOKEN, token);
|
||||
java.util.HashMap<String, Object> header = MessageBuilder.buildHeader(VALIDATE_AUTH_TOKEN, VERSION, replyTo);
|
||||
|
||||
return MessageBuilder.buildJson(header, payload);
|
||||
}
|
||||
|
||||
public static ValidateAuthTokenMessage fromJson(String message) {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(message);
|
||||
|
||||
if (obj.has("header") && obj.has("payload")) {
|
||||
JsonObject header = (JsonObject) obj.get("header");
|
||||
JsonObject payload = (JsonObject) obj.get("payload");
|
||||
|
||||
if (header.has("name")) {
|
||||
String messageName = header.get("name").getAsString();
|
||||
if (VALIDATE_AUTH_TOKEN.equals(messageName)) {
|
||||
if (payload.has(Constants.MEETING_ID)
|
||||
&& payload.has(Constants.USER_ID)
|
||||
&& payload.has(Constants.AUTH_TOKEN)
|
||||
&& header.has(Constants.REPLY_TO)) {
|
||||
String id = payload.get(Constants.MEETING_ID).getAsString();
|
||||
String userid = payload.get(Constants.USER_ID).getAsString();
|
||||
String authToken = payload.get(Constants.AUTH_TOKEN).getAsString();
|
||||
String replyTo = header.get(Constants.REPLY_TO).getAsString();
|
||||
String sessionId = "tobeimplemented";
|
||||
return new ValidateAuthTokenMessage(id, userid, authToken, replyTo,
|
||||
sessionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,8 @@ import java.util.Map;
|
||||
import org.bigbluebutton.conference.service.messaging.GetChatHistory;
|
||||
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
|
||||
import org.bigbluebutton.conference.service.messaging.SendPublicChatMessage;
|
||||
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
|
||||
import org.bigbluebutton.conference.service.messaging.ValidateAuthTokenMessage;
|
||||
import org.bigbluebutton.conference.service.messaging.redis.MessageSender;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
@ -100,8 +102,8 @@ public class Red5BBBInGw implements IBigBlueButtonInGW {
|
||||
@Override
|
||||
public void validateAuthToken(String meetingId, String userId,
|
||||
String token, String correlationId, String sessionId) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
ValidateAuthTokenMessage msg = new ValidateAuthTokenMessage(meetingId, userId, token, correlationId, sessionId);
|
||||
sender.send(MessagingConstants.TO_MEETING_CHANNEL, msg.toJson());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,7 +151,7 @@ class UsersClientMessageSender(service: ConnectionInvokerService) extends OutMes
|
||||
val gson = new Gson();
|
||||
message.put("msg", gson.toJson(args))
|
||||
|
||||
// println("UsersClientMessageSender - handleValidateAuthTokenReply \n" + message.get("msg") + "\n")
|
||||
println("UsersClientMessageSender - handleValidateAuthTokenTimedOut \n" + message.get("msg") + "\n")
|
||||
val m = new DirectClientMessage(msg.meetingID, msg.requesterId, "validateAuthTokenTimedOut", message);
|
||||
service.sendMessage(m);
|
||||
}
|
||||
@ -167,7 +167,7 @@ class UsersClientMessageSender(service: ConnectionInvokerService) extends OutMes
|
||||
val gson = new Gson();
|
||||
message.put("msg", gson.toJson(args))
|
||||
|
||||
// println("UsersClientMessageSender - handleValidateAuthTokenReply \n" + message.get("msg") + "\n")
|
||||
println("UsersClientMessageSender - handleValidateAuthTokenReply \n" + message.get("msg") + "\n")
|
||||
val m = new DirectClientMessage(msg.meetingID, msg.requesterId, "validateAuthTokenReply", message);
|
||||
service.sendMessage(m);
|
||||
}
|
||||
|
@ -64,6 +64,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<property name="bigBlueButtonInGW">
|
||||
<ref bean="bbbInGW"/>
|
||||
</property>
|
||||
<property name="red5InGW">
|
||||
<ref bean="red5BbbInGW"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="connInvokerService" class="org.bigbluebutton.conference.meeting.messaging.red5.ConnectionInvokerService"
|
||||
|
Loading…
Reference in New Issue
Block a user