String clientURL = Red5.getConnectionLocal().getRemoteAddress();
log.debug("swfURL " + clientURL);
SOAPLogin soapLogin = soapLoginDao.get(secureHash);
if (soapLogin.getUsed()) {
if (soapLogin.getAllowSameURLMultipleTimes()) {
if (!soapLogin.getClientURL().equals(clientURL)) {
log.debug("does not equal " + clientURL);
return -42L;
}
} else {
log.debug("Already used " + secureHash);
return -42L;
}
}
Long loginReturn = loginUserByRemote(soapLogin.getSessionHash());
IConnection current = Red5.getConnectionLocal();
String streamId = current.getClient().getId();
Client currentClient = sessionManager.getClientByStreamId(streamId, null);
if (currentClient.getUser_id() != null) {
sessiondataDao.updateUser(SID, currentClient.getUser_id());
}
currentClient.setAllowRecording(soapLogin.getAllowRecording());
sessionManager.updateClientByStreamId(streamId, currentClient, false, null);
if (loginReturn == null) {
log.debug("loginReturn IS NULL for SID: " + soapLogin.getSessionHash());
return -1L;
} else if (loginReturn < 0) {
log.debug("loginReturn IS < 0 for SID: " + soapLogin.getSessionHash());
return loginReturn;
} else {
soapLogin.setUsed(true);
soapLogin.setUseDate(new Date());
soapLogin.setClientURL(clientURL);
soapLoginDao.update(soapLogin);
// Create Return Object and hide the validated
// sessionHash that is stored server side
// this hash should be never thrown back to the user
SOAPLogin returnSoapLogin = new SOAPLogin();
returnSoapLogin.setRoom_id(soapLogin.getRoom_id());
returnSoapLogin.setBecomemoderator(soapLogin.getBecomemoderator());
returnSoapLogin.setShowAudioVideoTest(soapLogin.getShowAudioVideoTest());
returnSoapLogin.setRoomRecordingId(soapLogin.getRoomRecordingId());
returnSoapLogin.setShowNickNameDialog(soapLogin.getShowNickNameDialog());
returnSoapLogin.setLandingZone(soapLogin.getLandingZone());
return returnSoapLogin;
}
} catch (Exception err) {