Merge pull request #11525 from gustavotrott/develop
Adds lastAuthTokenValidatedOn to users
This commit is contained in:
commit
550bf6d282
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user