From ddfbed1a4dbbd8ed32470f73b2d8ad7fc03cdd0f Mon Sep 17 00:00:00 2001 From: Parthasarathy Dharmalingam Date: Mon, 30 Nov 2020 22:04:34 +0530 Subject: [PATCH] Session shadow/terminate issues fixed. --- Myrtille.Web/Default.aspx | 12 +- Myrtille.Web/Default.aspx.cs | 13 ++- Myrtille.Web/Default.aspx.designer.cs | 151 +++++++++++++++++--------- Myrtille.Web/css/securden.css | 2 +- Myrtille.Web/src/RemoteSession.cs | 1 + Myrtille.Web/src/Utils/WebRequest.cs | 17 ++- 6 files changed, 128 insertions(+), 68 deletions(-) diff --git a/Myrtille.Web/Default.aspx b/Myrtille.Web/Default.aspx index 93cb0d8..b783458 100644 --- a/Myrtille.Web/Default.aspx +++ b/Myrtille.Web/Default.aspx @@ -35,7 +35,7 @@ - <%=RemoteSession != null && !RemoteSession.ConnectionService && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected) && !string.IsNullOrEmpty(RemoteSession.ServerAddress) ? (((!string.IsNullOrEmpty(RemoteSession.UserDomain))? RemoteSession.UserDomain.ToString() + "\\" : "") + RemoteSession.UserName.ToString() + "@" + RemoteSession.ServerAddress.ToString() + " | Securden RDP Session") : "Securden RDP Gateway"%> + <%=RemoteSession != null && !RemoteSession.ConnectionService && (RemoteSession.State == RemoteSessionState.Connecting || RemoteSession.State == RemoteSessionState.Connected) && !string.IsNullOrEmpty(RemoteSession.ServerAddress) ? ((RemoteSession.isManageSession? "Session Shadow - " : "") + ((!string.IsNullOrEmpty(RemoteSession.UserDomain))? RemoteSession.UserDomain.ToString() + "\\" : "") + RemoteSession.UserName.ToString() + "@" + RemoteSession.ServerAddress.ToString() + " | Securden RDP Session") : "Securden RDP Gateway"%> "/> @@ -352,7 +352,7 @@
-
+
@@ -364,7 +364,7 @@ Clipboard
-
+
@@ -377,7 +377,7 @@ Run (Win+R)
-
+
@@ -389,7 +389,7 @@ Ctrl+Alt+Delete
-
+
@@ -402,7 +402,7 @@ Fit to Screen
-
+
diff --git a/Myrtille.Web/Default.aspx.cs b/Myrtille.Web/Default.aspx.cs index d846343..06c6dc2 100644 --- a/Myrtille.Web/Default.aspx.cs +++ b/Myrtille.Web/Default.aspx.cs @@ -250,6 +250,10 @@ protected void Page_Load( } RemoteSession = null; } + else if (Session[HttpSessionStateVariables.GuestInfo.ToString()] != null) + { + remoteOperationsDiv.Visible = false; + } } catch (Exception exc) { @@ -565,6 +569,7 @@ private bool ConnectRemoteServer() { userProfileId = (long)connectionDetails["user_profile_id"]; userSessionId = (long)connectionDetails["user_session_id"]; + accessUrl = (string)connectionDetails["ACCESS_URL"]; if ((string)connectionDetails["type"] == "SHADOW_SESSION") { connectionDetails = (JObject)connectionDetails["details"]; @@ -586,6 +591,7 @@ private bool ConnectRemoteServer() Control = false, } }; + sharingInfo.RemoteSession.isManageSession = true; sharedSessions.Add(sharingInfo.GuestInfo.Id, sharingInfo); guestShareId = sharingInfo.GuestInfo.Id.ToString(); @@ -608,7 +614,8 @@ private bool ConnectRemoteServer() } else { - Response.Write(""); + SecurdenWeb.ManageSessionRequest(accessUrl, (string)connectionDetails["connection_id"], false); + Response.Write(""); } return false; } @@ -637,11 +644,11 @@ private bool ConnectRemoteServer() } else { - Response.Write(""); + SecurdenWeb.ManageSessionRequest(accessUrl, (string)connectionDetails["connection_id"], false); + Response.Write(""); } return false; } - accessUrl = (string)connectionDetails["ACCESS_URL"]; connectionDetails = (JObject)connectionDetails["details"]; loginServer = (string)connectionDetails["address"]; loginDomain = ""; diff --git a/Myrtille.Web/Default.aspx.designer.cs b/Myrtille.Web/Default.aspx.designer.cs index 226ae8e..f33fa70 100644 --- a/Myrtille.Web/Default.aspx.designer.cs +++ b/Myrtille.Web/Default.aspx.designer.cs @@ -7,11 +7,13 @@ // //------------------------------------------------------------------------------ -namespace Myrtille.Web { - - - public partial class Default { - +namespace Myrtille.Web +{ + + + public partial class Default + { + /// /// mainForm control. /// @@ -20,7 +22,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm mainForm; - + /// /// width control. /// @@ -29,7 +31,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden width; - + /// /// height control. /// @@ -38,7 +40,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden height; - + /// /// login control. /// @@ -47,7 +49,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl login; - + /// /// logo control. /// @@ -56,7 +58,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl logo; - + /// /// hostConnectDiv control. /// @@ -65,7 +67,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl hostConnectDiv; - + /// /// hostType control. /// @@ -74,7 +76,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlSelect hostType; - + /// /// securityProtocol control. /// @@ -83,7 +85,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlSelect securityProtocol; - + /// /// server control. /// @@ -92,7 +94,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText server; - + /// /// vmGuid control. /// @@ -101,7 +103,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText vmGuid; - + /// /// vmEnhancedMode control. /// @@ -110,7 +112,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputCheckBox vmEnhancedMode; - + /// /// domain control. /// @@ -119,7 +121,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText domain; - + /// /// user control. /// @@ -128,7 +130,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText user; - + /// /// password control. /// @@ -137,7 +139,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputPassword password; - + /// /// passwordHash control. /// @@ -146,7 +148,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputHidden passwordHash; - + /// /// mfaDiv control. /// @@ -155,7 +157,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl mfaDiv; - + /// /// mfaProvider control. /// @@ -164,7 +166,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlAnchor mfaProvider; - + /// /// mfaPassword control. /// @@ -173,7 +175,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText mfaPassword; - + /// /// program control. /// @@ -182,7 +184,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText program; - + /// /// connect control. /// @@ -191,7 +193,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputSubmit connect; - + /// /// adminDiv control. /// @@ -200,7 +202,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl adminDiv; - + /// /// adminUrl control. /// @@ -209,7 +211,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlAnchor adminUrl; - + /// /// adminText control. /// @@ -218,7 +220,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl adminText; - + /// /// connectError control. /// @@ -227,7 +229,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl connectError; - + /// /// hosts control. /// @@ -236,7 +238,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl hosts; - + /// /// enterpriseUserInfo control. /// @@ -245,7 +247,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText enterpriseUserInfo; - + /// /// newRDPHost control. /// @@ -254,7 +256,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton newRDPHost; - + /// /// newSSHHost control. /// @@ -263,7 +265,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton newSSHHost; - + /// /// logout control. /// @@ -272,7 +274,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton logout; - + /// /// hostsList control. /// @@ -281,7 +283,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Repeater hostsList; - + /// /// toolbarToggle control. /// @@ -290,7 +292,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl toolbarToggle; - + /// /// toolbar control. /// @@ -299,7 +301,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl toolbar; - + /// /// serverInfo control. /// @@ -308,7 +310,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText serverInfo; - + /// /// userInfo control. /// @@ -317,7 +319,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputText userInfo; - + /// /// scale control. /// @@ -326,7 +328,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton scale; - + /// /// reconnect control. /// @@ -335,7 +337,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton reconnect; - + /// /// keyboard control. /// @@ -344,7 +346,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton keyboard; - + /// /// clipboard control. /// @@ -353,7 +355,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton clipboard; - + /// /// files control. /// @@ -362,7 +364,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton files; - + /// /// cad control. /// @@ -371,7 +373,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton cad; - + /// /// mrc control. /// @@ -380,7 +382,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton mrc; - + /// /// vswipe control. /// @@ -389,7 +391,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton vswipe; - + /// /// share control. /// @@ -398,7 +400,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton share; - + /// /// disconnect control. /// @@ -407,7 +409,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlInputButton disconnect; - + /// /// loadingDiv control. /// @@ -416,7 +418,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl loadingDiv; - + /// /// certificateDiv control. /// @@ -425,7 +427,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl certificateDiv; - + /// /// remoteOperationsDivWrap control. /// @@ -434,7 +436,7 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl remoteOperationsDivWrap; - + /// /// remoteOperationsDiv control. /// @@ -443,5 +445,50 @@ public partial class Default { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl remoteOperationsDiv; + + /// + /// clipboardOperDiv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl clipboardOperDiv; + + /// + /// winrOperDiv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl winrOperDiv; + + /// + /// ctrlaltdelOperDiv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl ctrlaltdelOperDiv; + + /// + /// resizeOperDiv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl resizeOperDiv; + + /// + /// disconnectOperDiv control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl disconnectOperDiv; } } diff --git a/Myrtille.Web/css/securden.css b/Myrtille.Web/css/securden.css index b81d004..865b0bf 100644 --- a/Myrtille.Web/css/securden.css +++ b/Myrtille.Web/css/securden.css @@ -231,7 +231,7 @@ span.webrdp-dialog-message-text { text-align: center; height: 56px; top: -56px; - left: calc(50% - 240px); + left: calc(50% - 300px); opacity: .75; background-color: #26282a; transition: top .5s ease-in-out; diff --git a/Myrtille.Web/src/RemoteSession.cs b/Myrtille.Web/src/RemoteSession.cs index fe9a033..a402e09 100644 --- a/Myrtille.Web/src/RemoteSession.cs +++ b/Myrtille.Web/src/RemoteSession.cs @@ -35,6 +35,7 @@ public class RemoteSession public long UserProfileId; public long UserSessionId; public string accessUrl; + public bool isManageSession; public Guid Id; public RemoteSessionState State; diff --git a/Myrtille.Web/src/Utils/WebRequest.cs b/Myrtille.Web/src/Utils/WebRequest.cs index 6670373..bcbf97a 100644 --- a/Myrtille.Web/src/Utils/WebRequest.cs +++ b/Myrtille.Web/src/Utils/WebRequest.cs @@ -63,7 +63,7 @@ private static JObject SecurdenWebRequest(string serverUrl, string requestUrl, s public static void ManageSessionRequest(string serverUrl, string connectionId, bool status) { - if (serverUrl != null) + if (serverUrl != null && serverUrl != String.Empty) { JObject paramObj = new JObject(new JProperty("CONNECTION_ID", connectionId), new JProperty("STATUS", status)); SecurdenWebRequest(serverUrl, "/launcher/manage_web_session", "POST", paramObj); @@ -75,6 +75,7 @@ public static JObject ProcessLaunchRequest(HttpRequest Request, HttpResponse Res JObject returnObj = null; JObject paramObj = new JObject(new JProperty("AUTH_KEY", authKey), new JProperty("CONNECTION_ID", connectionId)); JObject response = null; + string serverAccessUrl = null; if (Request["access_url"] != null && Request["access_url"].Trim() != "") { string accessUrl = Request["access_url"].Trim(); @@ -83,16 +84,16 @@ public static JObject ProcessLaunchRequest(HttpRequest Request, HttpResponse Res accessUrl = accessUrl.Substring(0, accessUrl.Length - 1); } response = SecurdenWebRequest(accessUrl, "/launcher/verify_launch_info", "POST", paramObj); - if (response != null && ((JObject)response["details"]).ContainsKey("is_remote_session_managed") && (bool)response["details"]["is_remote_session_managed"]) + if (response != null) { - response["ACCESS_URL"] = accessUrl; + serverAccessUrl = accessUrl; } - else if (response == null) + else { response = SecurdenWebRequest(serverUrl, "/launcher/verify_launch_info", "POST", paramObj); - if (response != null && ((JObject)response["details"]).ContainsKey("is_remote_session_managed") && (bool)response["details"]["is_remote_session_managed"]) + if (response != null) { - response["ACCESS_URL"] = serverUrl; + serverAccessUrl = serverUrl; } } } @@ -104,6 +105,10 @@ public static JObject ProcessLaunchRequest(HttpRequest Request, HttpResponse Res { if ((string)response["type"] == "WEB_RDP" || (string)response["type"] == "SHADOW_SESSION" || (string)response["type"] == "TERMINATE_SESSION") { + if ((string)response["type"] == "SHADOW_SESSION" || (string)response["type"] == "TERMINATE_SESSION" || (((JObject)response["details"]).ContainsKey("is_remote_session_managed") && (bool)response["details"]["is_remote_session_managed"])) + { + response["ACCESS_URL"] = serverAccessUrl; + } returnObj = response; } else