diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala index 275786b05a..8ebc33ac0f 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala @@ -75,7 +75,7 @@ trait ValidateAuthTokenReqMsgHdlr extends HandlerHelpers { reasonCode: String, state: MeetingState2x ): MeetingState2x = { - val event = MsgBuilder.buildValidateAuthTokenRespMsg(meetingId, userId, authToken, valid, waitForApproval, 0) + val event = MsgBuilder.buildValidateAuthTokenRespMsg(meetingId, userId, authToken, valid, waitForApproval, 0, 0) outGW.send(event) // send a system message to force disconnection @@ -86,14 +86,16 @@ trait ValidateAuthTokenReqMsgHdlr extends HandlerHelpers { } def sendValidateAuthTokenRespMsg(meetingId: String, userId: String, authToken: String, - valid: Boolean, waitForApproval: Boolean, registeredOn: Long): Unit = { - val event = MsgBuilder.buildValidateAuthTokenRespMsg(meetingId, userId, authToken, valid, waitForApproval, registeredOn) + valid: Boolean, waitForApproval: Boolean, registeredOn: Long, authTokenValidatedOn: Long): Unit = { + val event = MsgBuilder.buildValidateAuthTokenRespMsg(meetingId, userId, authToken, valid, waitForApproval, registeredOn, authTokenValidatedOn) outGW.send(event) } def userValidated(user: RegisteredUser, state: MeetingState2x): MeetingState2x = { val meetingId = liveMeeting.props.meetingProp.intId - sendValidateAuthTokenRespMsg(meetingId, user.id, user.authToken, valid = true, waitForApproval = false, user.registeredOn) + val updatedUser = RegisteredUsers.updateUserLastAuthTokenValidated(liveMeeting.registeredUsers, user) + + sendValidateAuthTokenRespMsg(meetingId, updatedUser.id, updatedUser.authToken, valid = true, waitForApproval = false, updatedUser.registeredOn, updatedUser.lastAuthTokenValidatedOn) state } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala index 17e7f429ce..6fdf595778 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/RegisteredUsers.scala @@ -17,6 +17,7 @@ object RegisteredUsers { authenticated, guestStatus, System.currentTimeMillis(), + 0, false, false, false @@ -126,6 +127,12 @@ object RegisteredUsers { u } + def updateUserLastAuthTokenValidated(users: RegisteredUsers, user: RegisteredUser): RegisteredUser = { + val u = user.copy(lastAuthTokenValidatedOn = System.currentTimeMillis()) + users.save(u) + u + } + def markAsUserFailedToJoin(users: RegisteredUsers, user: RegisteredUser): RegisteredUser = { val u = user.copy(markAsJoinTimedOut = true) users.save(u) @@ -153,18 +160,19 @@ class RegisteredUsers { } case class RegisteredUser( - id: String, - externId: String, - name: String, - role: String, - authToken: String, - avatarURL: String, - guest: Boolean, - authed: Boolean, - guestStatus: String, - registeredOn: Long, - joined: Boolean, - markAsJoinTimedOut: Boolean, - banned: Boolean + id: String, + externId: String, + name: String, + role: String, + authToken: String, + avatarURL: String, + guest: Boolean, + authed: Boolean, + guestStatus: String, + registeredOn: Long, + lastAuthTokenValidatedOn: Long, + joined: Boolean, + markAsJoinTimedOut: Boolean, + banned: Boolean ) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala index bb9976e382..17570d2f43 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala @@ -74,11 +74,11 @@ object MsgBuilder { } def buildValidateAuthTokenRespMsg(meetingId: String, userId: String, authToken: String, - valid: Boolean, waitForApproval: Boolean, registeredOn: Long): BbbCommonEnvCoreMsg = { + valid: Boolean, waitForApproval: Boolean, registeredOn: Long, authTokenValidatedOn: Long): BbbCommonEnvCoreMsg = { val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId) val envelope = BbbCoreEnvelope(ValidateAuthTokenRespMsg.NAME, routing) val header = BbbClientMsgHeader(ValidateAuthTokenRespMsg.NAME, meetingId, userId) - val body = ValidateAuthTokenRespMsgBody(userId, authToken, valid, waitForApproval, registeredOn) + val body = ValidateAuthTokenRespMsgBody(userId, authToken, valid, waitForApproval, registeredOn, authTokenValidatedOn) val event = ValidateAuthTokenRespMsg(header, body) BbbCommonEnvCoreMsg(envelope, event) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/ValidateAuthTokenRespMsgSender.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/ValidateAuthTokenRespMsgSender.scala index f9ca2b62f8..5b37686972 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/ValidateAuthTokenRespMsgSender.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/ValidateAuthTokenRespMsgSender.scala @@ -6,11 +6,11 @@ import org.bigbluebutton.core.running.OutMsgRouter object ValidateAuthTokenRespMsgSender { def send(outGW: OutMsgRouter, meetingId: String, userId: String, authToken: String, - valid: Boolean, waitForApproval: Boolean, registeredOn: Long): Unit = { + valid: Boolean, waitForApproval: Boolean, registeredOn: Long, authTokenValidatedOn: Long): Unit = { val routing = Routing.addMsgToClientRouting(MessageTypes.DIRECT, meetingId, userId) val envelope = BbbCoreEnvelope(ValidateAuthTokenRespMsg.NAME, routing) val header = BbbClientMsgHeader(ValidateAuthTokenRespMsg.NAME, meetingId, userId) - val body = ValidateAuthTokenRespMsgBody(userId, authToken, valid, waitForApproval, registeredOn) + val body = ValidateAuthTokenRespMsgBody(userId, authToken, valid, waitForApproval, registeredOn, authTokenValidatedOn) val event = ValidateAuthTokenRespMsg(header, body) val msgEvent = BbbCommonEnvCoreMsg(envelope, event) outGW.send(msgEvent) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala index d3708c5676..7d7f1b2814 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMgs.scala @@ -59,7 +59,7 @@ case class ValidateAuthTokenRespMsg( header: BbbClientMsgHeader, body: ValidateAuthTokenRespMsgBody ) extends BbbCoreMsg -case class ValidateAuthTokenRespMsgBody(userId: String, authToken: String, valid: Boolean, waitForApproval: Boolean, registeredOn: Long) +case class ValidateAuthTokenRespMsgBody(userId: String, authToken: String, valid: Boolean, waitForApproval: Boolean, registeredOn: Long, authTokenValidatedOn: Long) object UserLeftMeetingEvtMsg { val NAME = "UserLeftMeetingEvtMsg" diff --git a/bigbluebutton-html5/imports/api/users/server/handlers/validateAuthToken.js b/bigbluebutton-html5/imports/api/users/server/handlers/validateAuthToken.js index 72904a13e1..0864987e1d 100644 --- a/bigbluebutton-html5/imports/api/users/server/handlers/validateAuthToken.js +++ b/bigbluebutton-html5/imports/api/users/server/handlers/validateAuthToken.js @@ -24,6 +24,7 @@ export default function handleValidateAuthToken({ body }, meetingId) { authToken, waitForApproval, registeredOn, + authTokenValidatedOn, } = body; check(userId, String); @@ -31,6 +32,7 @@ export default function handleValidateAuthToken({ body }, meetingId) { check(valid, Boolean); check(waitForApproval, Boolean); check(registeredOn, Number); + check(authTokenValidatedOn, Number); const pendingAuths = pendingAuthenticationsStore.take(meetingId, userId, authToken); @@ -111,6 +113,7 @@ export default function handleValidateAuthToken({ body }, meetingId) { validated: valid, approved: !waitForApproval, loginTime: registeredOn, + authTokenValidatedTime: authTokenValidatedOn, inactivityCheck: false, }, };