Updated RDWeb pages with the two-factor support

This commit is contained in:
Jakob A. Dam 2015-04-10 12:10:14 +02:00
parent 80da1889a3
commit 59d9b4b135
24 changed files with 735 additions and 229 deletions

Binary file not shown.

Binary file not shown.

View file

@ -10,9 +10,11 @@
void goToFolder(string getLangVal) void goToFolder(string getLangVal)
{ {
Response.Redirect(getLangVal + "/Default.aspx" + Request.Url.Query,true);
Response.Redirect(getLangVal + "/Default.aspx" + Request.Url.Query,true);
} }
void Page_Load(Object sender, EventArgs e) void Page_Load(Object sender, EventArgs e)
{ {
// Deny requests with "additional path information" // Deny requests with "additional path information"

Binary file not shown.

View file

@ -22,12 +22,11 @@
</xsl:if> </xsl:if>
<title ID="PAGE_TITLE"><xsl:value-of select="$strings[@id = 'PageTitle']"/></title> <title ID="PAGE_TITLE"><xsl:value-of select="$strings[@id = 'PageTitle']"/></title>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<link href="tswa.css" rel="stylesheet" type="text/css" /> <link href="tswa.css" rel="stylesheet" type="text/css" />
<xsl:apply-templates select="Style"/> <xsl:apply-templates select="Style"/>
<script language="javascript" type="text/javascript" src='../renderscripts.js'/> <script language="javascript" type="text/javascript" src='../renderscripts.js'/>
<script language="javascript" type="text/javascript" src='../webscripts-domain.js'/>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
var sHelpSource = &quot;<xsl:value-of select="@helpurl"/>&quot;; var sHelpSource = &quot;<xsl:value-of select="@helpurl"/>&quot;;
<xsl:value-of select="HeaderJS[1]"/> <xsl:value-of select="HeaderJS[1]"/>
@ -378,7 +377,7 @@
ActiveXMode = <xsl:value-of select="$feedidprefix"/>LoadControl(); ActiveXMode = <xsl:value-of select="$feedidprefix"/>LoadControl();
if (ActiveXMode &amp;&amp; <xsl:value-of select="$feedidprefix"/>Controls.PORTAL_REMOTE_DESKTOPS != null) if (ActiveXMode)
{ {
<xsl:value-of select="$feedidprefix"/>Controls.PORTAL_REMOTE_DESKTOPS.style.display = "inline"; <xsl:value-of select="$feedidprefix"/>Controls.PORTAL_REMOTE_DESKTOPS.style.display = "inline";
} }
@ -423,7 +422,7 @@
obj += "classid='CLSID:7390f3d8-0439-4c05-91e3-cf5cb290c3d0'>"; obj += "classid='CLSID:7390f3d8-0439-4c05-91e3-cf5cb290c3d0'>";
} }
obj += "&lt;/object&gt;"; obj += "&lt;/object&gt;";
obj += "&lt;script language='javascript' type='text/javascript'&gt; var MsRdpClient = document.getElementById('MsRdpClient'); &lt;\/script&gt;"; obj += "var MsRdpClient = document.getElementById('MsRdpClient');";
document.getElementById("<xsl:value-of select="$feedidprefix"/>oDivMsRdpClient").insertAdjacentHTML("beforeEnd",obj); document.getElementById("<xsl:value-of select="$feedidprefix"/>oDivMsRdpClient").insertAdjacentHTML("beforeEnd",obj);
if ( WebAccessControlPresent ) { if ( WebAccessControlPresent ) {
@ -433,7 +432,7 @@
MsRdpClientShell = MsRdpClient.MsRdpClientShell; MsRdpClientShell = MsRdpClient.MsRdpClientShell;
} }
if (!MsRdpClient || MsRdpClientShell == null) { if (!MsRdpClient || (MsRdpClient.readyState != 4) || MsRdpClientShell == null) {
retval = false; retval = false;
<xsl:value-of select="$feedidprefix"/>OnControlLoadError(); <xsl:value-of select="$feedidprefix"/>OnControlLoadError();
} }
@ -633,21 +632,29 @@
}; };
function tswa_bossOver(obj){ function tswa_bossOver(obj){
obj.children[0].children[0].className = 'tswa_vis1'; obj.children[0].children[0].className = 'tswa_vis1';
obj.children[0].style.padding = "10px 3px 2px 2px"; obj.children[0].style.padding = "10px 3px 2px 2px";
} }
function tswa_bossOut(obj){ function tswa_bossOut(obj){
obj.children[0].children[0].className = "tswa_vis0"; obj.children[0].children[0].className = "tswa_vis0";
obj.children[0].style.padding = "12px 1px 0px 4px"; obj.children[0].style.padding = "12px 1px 0px 4px";
} }
function goRDP(pid, rdpContents, url) { function goRDP(pid, rdpContents, url) {
var wnd = window.open("token.aspx?User=" + getUserNameRdpProperty(), "Launch application","location=0,status=0,scrollbars=0, width=200,height=100");
<!--wnd.addEventListener('load', wnd.doSomething, true);-->
setTimeout(function() {
wnd.close();
}, 2000);
if (ActiveXMode) { if (ActiveXMode) {
try {
goRDPAx(pid, rdpContents); goRDPAx(pid, rdpContents);
} catch (e) {
location.href = url;
}
} }
else { else {
location.href = url; location.href = url;
@ -679,7 +686,7 @@
if (<xsl:value-of select="$feedidprefix"/>Controls.chkShowOptimizeExperience.checked) { if (<xsl:value-of select="$feedidprefix"/>Controls.chkShowOptimizeExperience.checked) {
var objRegExp = new RegExp("connection type:i:([0-9]+)", "i"); var objRegExp = new RegExp("connection type:i:([0-9]+)", "i");
var iIndex = strRdpFileContents.search( objRegExp ); var iIndex = strRdpFileContents.search( objRegExp );
<!-- Add 'connection type' if it does exist otherwise replace. --> <!-- Add 'connection type' if it does exist otherwise replace. -->
if ( -1 == iIndex ) { if ( -1 == iIndex ) {
if ( "\\n" != strRdpFileContents.charAt(strRdpFileContents.length-1) ) { if ( "\\n" != strRdpFileContents.charAt(strRdpFileContents.length-1) ) {
strRdpFileContents += "\\r\\n"; strRdpFileContents += "\\r\\n";
@ -691,24 +698,39 @@
} }
</xsl:if> </xsl:if>
MsRdpClientShell.RdpFileContents = unescape(strRdpFileContents); <!-- var objRegExpS = new RegExp("server port:i:([1-65535]+)", "i");
var iIndexS = strRdpFileContents.search( objRegExp );
Add 'connection type' if it does exist otherwise replace. server port:i:3389
if ( -1 == iIndexS ) {
if ( "\\n" != strRdpFileContents.charAt(strRdpFileContents.length-1) ) {
strRdpFileContents += "\\r\\n";
}
strRdpFileContents += "server port:i:11443\\r\\n";
} else {
strRdpFileContents = strRdpFileContents.replace(objRegExpS, "server port:i:11443");
try {
MsRdpClientShell.Launch(); strRdpFileContents = strRdpFileContents.replace("server port", "server prut");
} } -->
catch(e){
throw e; MsRdpClientShell.RdpFileContents = unescape(strRdpFileContents);
}
try {
MsRdpClientShell.Launch();
}
catch(e){
throw e;
}
} }
function goNonRDP(pid, arg) { function goNonRDP(pid, arg) {
try { try {
location.href = unescape(arg); location.href = unescape(arg);
} }
catch(e){ catch(e){
throw e; throw e;
} }
} }

View file

@ -1,4 +1,4 @@
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Note: As an alternative to hand editing this file you can use the Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use web admin tool to configure settings for your application. Use
@ -11,7 +11,7 @@
<!-- Admin Defined settings --> <!-- Admin Defined settings -->
<appSettings> <appSettings>
<!-- PasswordChangeEnabled: Provides password change page for users. Value must be "true" or "false" --> <!-- PasswordChangeEnabled: Provides password change page for users. Value must be "true" or "false" -->
<add key="PasswordChangeEnabled" value="false" /> <add key="PasswordChangeEnabled" value="true" />
<!-- LocalHelp: Displays local help for users, instead of the web-based help. Value must be "true" or "false" --> <!-- LocalHelp: Displays local help for users, instead of the web-based help. Value must be "true" or "false" -->
<add key="LocalHelp" value="false" /> <add key="LocalHelp" value="false" />
@ -42,12 +42,18 @@
<add key="PrivateModeSessionTimeoutInMinutes" value="240" /> <add key="PrivateModeSessionTimeoutInMinutes" value="240" />
<!-- Checkbox to opt for optimized LAN experience --> <!-- Checkbox to opt for optimized LAN experience -->
<add key="ShowOptimizeExperience" value="false" /> <add key="ShowOptimizeExperience" value="true" />
<add key="OptimizeExperienceState" value="false" /> <add key="OptimizeExperienceState" value="false" />
<add key="SmsToken" value="true" />
<add key="RadiusServer" value="192.168.121.9" />
<add key="RadiusSecret" value="helloworld" />
<add key="OTP" value="true" />
<add key="EnableSMS" value="true" />
<add key="EnableMail" value="false" />
</appSettings> </appSettings>
<connectionStrings/> <connectionStrings />
<system.web> <system.web>
<!-- <!--
@ -76,7 +82,7 @@
<webParts> <webParts>
<personalization defaultProvider="TSPortalProvider"> <personalization defaultProvider="TSPortalProvider">
<providers> <providers>
<add name="TSPortalProvider" type="Microsoft.TerminalServices.Publishing.Portal.TSPortalProvider"/> <add name="TSPortalProvider" type="Microsoft.TerminalServices.Publishing.Portal.TSPortalProvider" />
</providers> </providers>
<authorization> <authorization>
<allow users="*" verbs="enterSharedScope"> <allow users="*" verbs="enterSharedScope">
@ -89,7 +95,7 @@
<system.webServer> <system.webServer>
<modules runAllManagedModulesForAllRequests="true"> <modules runAllManagedModulesForAllRequests="true">
<remove name="FormsAuthentication" /> <remove name="FormsAuthentication" />
<add name="RDWAFormsAuthenticationModule" type="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication.TSDomainFormsAuthentication" /> <add name="RDWAFormsAuthenticationModule" type="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication.TSFormsAuthentication" />
</modules> </modules>
<security> <security>
@ -105,7 +111,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly> <dependentAssembly>
<assemblyIdentity name="TSPortalWebPart" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <assemblyIdentity name="TSPortalWebPart" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="6.0.0.0" newVersion="6.1.0.0"/> <bindingRedirect oldVersion="6.0.0.0" newVersion="6.1.0.0" />
</dependentAssembly> </dependentAssembly>
</assemblyBinding> </assemblyBinding>
</runtime> </runtime>
@ -118,7 +124,7 @@
</system.web> </system.web>
<system.webServer> <system.webServer>
<handlers> <handlers>
<add name="RDWAResourceFileHandler" path="rdp" verb="*" type="Microsoft.TerminalServices.Publishing.Portal.ResourceFileHandler" preCondition="integratedMode" allowPathInfo="true"/> <add name="RDWAResourceFileHandler" path="rdp" verb="*" type="Microsoft.TerminalServices.Publishing.Portal.ResourceFileHandler" preCondition="integratedMode" allowPathInfo="true" />
</handlers> </handlers>
</system.webServer> </system.webServer>
</location> </location>

View file

@ -1,2 +1,2 @@
<%@ Page Language="C#" CodeFile="WebFeed.aspx.cs" Inherits="TSWF_PagesVdir.TsWebFeed" Trace="false" %> <%@ Page Language="C#" CodeFile="WebFeed.aspx.cs" Inherits="TSWF.TsWebFeed" Trace="false" %>
<%=oXML%> <%=oXML%>

View file

@ -16,7 +16,7 @@ using System.Web.Configuration;
using System.Xml; using System.Xml;
using Microsoft.TerminalServices.Publishing.Portal.FormAuthentication; using Microsoft.TerminalServices.Publishing.Portal.FormAuthentication;
namespace TSWF_PagesVdir namespace TSWF
{ {
public partial class TsWebFeed : System.Web.UI.Page public partial class TsWebFeed : System.Web.UI.Page
{ {
@ -25,7 +25,7 @@ namespace TSWF_PagesVdir
protected void Page_Init(object sender, EventArgs e) protected void Page_Init(object sender, EventArgs e)
{ {
AuthenticationMode eAuthenticationMode = AuthenticationMode.None; AuthenticationMode eAuthenticationMode = AuthenticationMode.None;
string strUserIdentity = ""; string strSid = "";
AuthenticationSection objAuthenticationSection = ConfigurationManager.GetSection("system.web/authentication") as AuthenticationSection; AuthenticationSection objAuthenticationSection = ConfigurationManager.GetSection("system.web/authentication") as AuthenticationSection;
if ( objAuthenticationSection != null ) if ( objAuthenticationSection != null )
@ -37,13 +37,12 @@ namespace TSWF_PagesVdir
{ {
if ( HttpContext.Current.User.Identity.IsAuthenticated == false ) if ( HttpContext.Current.User.Identity.IsAuthenticated == false )
{ {
Uri baseUrl = new Uri(PageContentsHelper.GetBaseUri(Context), Request.FilePath + "/.."); Uri baseUrl = new Uri(Request.Url, Request.FilePath + "/..");
string queryString = PageContentsHelper.AppendTenantIdToQuery("?ReturnUrl=../WebFeed.aspx"); Response.Redirect(baseUrl.ToString() + "default.aspx?ReturnUrl=../WebFeed.aspx");
Response.Redirect(baseUrl.ToString() + "default.aspx" + queryString);
} }
TSFormAuthTicketInfo objTSFormAuthTicketInfo = new TSFormAuthTicketInfo(HttpContext.Current); TSFormAuthTicketInfo objTSFormAuthTicketInfo = new TSFormAuthTicketInfo(HttpContext.Current);
strUserIdentity = objTSFormAuthTicketInfo.UserIdentity; strSid = objTSFormAuthTicketInfo.UserSid;
// //
// TODO: Need to correctly call this // TODO: Need to correctly call this
// //
@ -71,19 +70,14 @@ namespace TSWF_PagesVdir
try try
{ {
WebFeed tswf = new WebFeed(rdpEmbed ? RdpType.Both : RdpType.Link, false); WebFeed tswf = new WebFeed(rdpEmbed ? RdpType.Both : RdpType.Link);
oXML = tswf.GenerateFeed(strUserIdentity, xmlVersion, Request.PathInfo, true); oXML = tswf.GenerateFeed(strSid, xmlVersion, Request.PathInfo, true);
} }
catch (WorkspaceUnknownFolderException) catch (WorkspaceUnknownFolderException)
{ {
Response.StatusCode = 404; Response.StatusCode = 404;
Response.End(); Response.End();
} }
catch (InvalidTenantException)
{
Response.StatusCode = 404;
Response.End();
}
catch (WorkspaceUnavailableException wue) catch (WorkspaceUnavailableException wue)
{ {
// This exception is raised when we cannot contact the appropriate sources to obtain the workspace information. // This exception is raised when we cannot contact the appropriate sources to obtain the workspace information.
@ -95,5 +89,7 @@ namespace TSWF_PagesVdir
Response.End(); Response.End();
} }
} }
} }
} }

View file

@ -34,7 +34,7 @@
public bool bShowOptimizeExperience = false, bOptimizeExperienceState = false; public bool bShowOptimizeExperience = false, bOptimizeExperienceState = false;
public AuthenticationMode eAuthenticationMode = AuthenticationMode.None; public AuthenticationMode eAuthenticationMode = AuthenticationMode.None;
public string strTicketName = ""; public string strTicketName = "";
public string strDomainUserName = "", strUserIdentity = ""; public string strDomainUserName = "", strUserSID = "";
public string strAppFeed; public string strAppFeed;
public WorkspaceInfo objWorkspaceInfo = null; public WorkspaceInfo objWorkspaceInfo = null;
@ -45,9 +45,9 @@
string strReturnUrl = ""; string strReturnUrl = "";
string strReturnUrlPage = ""; string strReturnUrlPage = "";
// gives us https://<hostname>[:port]/rdweb/pages/<lang>/ // gives us https://<machine>/rdweb/pages/<lang>/
baseUrl = new Uri(new Uri(PageContentsHelper.GetBaseUri(Context), Request.FilePath), "."); // baseUrl = new Uri(new Uri(Request.Url, Request.FilePath), ".");
baseUrl = new Uri(new Uri(GetRealRequestUri(), Request.FilePath), ".");
try try
{ {
string strShowOptimzeExperienceValue = ConfigurationManager.AppSettings["ShowOptimizeExperience"]; string strShowOptimzeExperienceValue = ConfigurationManager.AppSettings["ShowOptimizeExperience"];
@ -90,26 +90,26 @@
if ( eAuthenticationMode == AuthenticationMode.Forms ) if ( eAuthenticationMode == AuthenticationMode.Forms )
{ {
if ( HttpContext.Current.User.Identity.IsAuthenticated == false ) if ( HttpContext.Current.User.Identity.IsAuthenticated == false | (string)Session["SMSTOKEN"] == "NOT_SMS_AUTH" )
{ {
string strQueryString;
if (String.IsNullOrEmpty(strReturnUrl)) if (String.IsNullOrEmpty(strReturnUrl))
{ {
strQueryString = "?ReturnUrl=" + Request.Path;
Response.Redirect(new Uri(baseUrl,"login.aspx?ReturnUrl=" + Request.Path).AbsoluteUri);
} }
else else
{ {
strQueryString = strReturnUrl;
}
Response.Redirect(new Uri(baseUrl, "login.aspx" + PageContentsHelper.AppendTenantIdToQuery(strQueryString)).AbsoluteUri); Response.Redirect(new Uri(baseUrl, "login.aspx" + strReturnUrl).AbsoluteUri);
}
} }
TSFormAuthTicketInfo objTSFormAuthTicketInfo = new TSFormAuthTicketInfo(HttpContext.Current); TSFormAuthTicketInfo objTSFormAuthTicketInfo = new TSFormAuthTicketInfo(HttpContext.Current);
strUserIdentity = objTSFormAuthTicketInfo.UserIdentity; strUserSID = objTSFormAuthTicketInfo.UserSid;
bPrivateMode = objTSFormAuthTicketInfo.PrivateMode; bPrivateMode = objTSFormAuthTicketInfo.PrivateMode;
strDomainUserName = objTSFormAuthTicketInfo.DomainUserName; strDomainUserName = objTSFormAuthTicketInfo.DomainUserName;
if ( bPrivateMode == true ) if ( bPrivateMode == true )
{ {
try try
@ -163,9 +163,9 @@
WebFeed tswf = null; WebFeed tswf = null;
try try
{ {
tswf = new WebFeed(RdpType.Both, true); tswf = new WebFeed(RdpType.Both);
strAppFeed = tswf.GenerateFeed( strAppFeed = tswf.GenerateFeed(
strUserIdentity, strUserSID,
FeedXmlVersion.Win8, FeedXmlVersion.Win8,
(Request.PathInfo.Length > 0) ? Request.PathInfo : "/", (Request.PathInfo.Length > 0) ? Request.PathInfo : "/",
false); false);
@ -174,11 +174,6 @@
{ {
BadFolderRedirect(); BadFolderRedirect();
} }
catch (InvalidTenantException)
{
Response.StatusCode = 404;
Response.End();
}
catch (WorkspaceUnavailableException wue) catch (WorkspaceUnavailableException wue)
{ {
// This exception is raised when we cannot contact the appropriate sources to obtain the workspace information. // This exception is raised when we cannot contact the appropriate sources to obtain the workspace information.
@ -206,6 +201,30 @@
Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetCacheability(HttpCacheability.NoCache);
} }
public static Uri GetRealRequestUri()
{
if ((HttpContext.Current == null) ||
(HttpContext.Current.Request == null))
throw new ApplicationException("Cannot get current request.");
return GetRealRequestUri(HttpContext.Current.Request);
}
public static Uri GetRealRequestUri(HttpRequest request)
{
if (String.IsNullOrEmpty(request.Headers["Host"]))
return request.Url;
UriBuilder ub = new UriBuilder(request.Url);
string[] realHost = request.Headers["Host"].Split(':');
string host = realHost[0];
ub.Host = host;
string portString = realHost.Length > 1 ? realHost[1] : "";
int port;
if (int.TryParse(portString, out port))
ub.Port = port;
return ub.Uri;
}
private void BadFolderRedirect() private void BadFolderRedirect()
{ {
Response.ContentType = "text/html"; Response.ContentType = "text/html";
@ -217,11 +236,14 @@
</head> </head>
<body> <body>
<p id=""BadFolder1"">" + L_BadFolderErrorBody_Text + @"</p> <p id=""BadFolder1"">" + L_BadFolderErrorBody_Text + @"</p>
</body> </body>
</html>"); </html>");
Response.End(); Response.End();
} }
</script> </script>
<%="<?xml-stylesheet type=\"text/xsl\" href=\"" + SecurityElement.Escape(stylesheetUrl.AbsoluteUri) + "\"?>"%> <%="<?xml-stylesheet type=\"text/xsl\" href=\"" + SecurityElement.Escape(stylesheetUrl.AbsoluteUri) + "\"?>"%>
<%="<?xml-stylesheet type=\"text/css\" href=\"" + SecurityElement.Escape(renderFailCssUrl.AbsoluteUri) + "\"?>"%> <%="<?xml-stylesheet type=\"text/css\" href=\"" + SecurityElement.Escape(renderFailCssUrl.AbsoluteUri) + "\"?>"%>
@ -242,6 +264,7 @@
<p><%=L_RenderFailP1_Text%></p> <p><%=L_RenderFailP1_Text%></p>
<p><%=L_RenderFailP2_Text%></p> <p><%=L_RenderFailP2_Text%></p>
<p><%=L_RenderFailP3_Text%></p> <p><%=L_RenderFailP3_Text%></p>
</body> </body>
</html> </html>
</RenderFailureMessage> </RenderFailureMessage>
@ -518,6 +541,7 @@
background-color:white; background-color:white;
} }
</Style> </Style>
<AppFeed <AppFeed
showpubliccheckbox="<%=bShowPublicCheckBox.ToString().ToLower()%>" showpubliccheckbox="<%=bShowPublicCheckBox.ToString().ToLower()%>"
privatemode="<%=bPrivateMode.ToString().ToLower()%>" privatemode="<%=bPrivateMode.ToString().ToLower()%>"
@ -531,6 +555,9 @@
} }
%> %>
> >
<%=strAppFeed%> <%=strAppFeed%>
</AppFeed> </AppFeed>
</RDWAPage> </RDWAPage>

View file

@ -108,8 +108,8 @@
Response.End(); Response.End();
} }
// gives us https://<hostname>[:port]/rdweb/pages/<lang>/ // gives us https://<machine>/rdweb/pages/<lang>/
baseUrl = new Uri(new Uri(PageContentsHelper.GetBaseUri(Context), Request.FilePath), "."); baseUrl = new Uri(new Uri(Request.Url, Request.FilePath), ".");
AuthenticationSection objAuthenticationSection = ConfigurationManager.GetSection("system.web/authentication") as AuthenticationSection; AuthenticationSection objAuthenticationSection = ConfigurationManager.GetSection("system.web/authentication") as AuthenticationSection;
if ( objAuthenticationSection != null ) if ( objAuthenticationSection != null )
@ -155,7 +155,7 @@
} }
} }
objWorkspaceInfo = PageContentsHelper.GetWorkspaceInfo(); objWorkspaceInfo = RdwaConfig.GetWorkspaceInfo();
if ( objWorkspaceInfo != null ) if ( objWorkspaceInfo != null )
{ {
string strWorkspaceName = objWorkspaceInfo.WorkspaceName; string strWorkspaceName = objWorkspaceInfo.WorkspaceName;

View file

@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="cook.aspx.cs" Inherits="Pages_en_US_cook" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>

View file

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Pages_en_US_cook : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie myCookie = new HttpCookie("RadiusSessionId");
DateTime now = DateTime.Now;
// Set the cookie value.
myCookie.Value = now.ToString();
// Set the cookie expiration date.
myCookie.Expires = now.AddMinutes(480);
// Add the cookie.
Response.Cookies.Add(myCookie);
Response.Write("<p> The cookie has been written.");
}
}

View file

@ -6,6 +6,7 @@
<% @Import Namespace="System.Security" %> <% @Import Namespace="System.Security" %>
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication" %> <% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication" %>
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal" %> <% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal" %>
<% @Import Namespace="RadiusClient" %>
<script language="C#" runat=server> <script language="C#" runat=server>
// //
@ -25,6 +26,8 @@
const string L_ExistingWorkspaceLabel_Text = "Another user of your computer is currently using this connection. This user must disconnect before you can log on."; const string L_ExistingWorkspaceLabel_Text = "Another user of your computer is currently using this connection. This user must disconnect before you can log on.";
const string L_DisconnectedWorkspaceLabel_Text = "Another user of your computer has disconnected from this connection. Please type your user name and password again."; const string L_DisconnectedWorkspaceLabel_Text = "Another user of your computer has disconnected from this connection. Please type your user name and password again.";
const string L_LogonFailureLabel_Text = "The user name or password that you entered is not valid. Try typing it again."; const string L_LogonFailureLabel_Text = "The user name or password that you entered is not valid. Try typing it again.";
const string L_LogonSMSFailureLabel_Text = "The token code that you entered is not valid. Try again.";
const string L_LogonRadiusFailureLabel_Text = "The radius server did not respond. Check radius configuration or give it another try.";
const string L_DomainNameMissingLabel_Text = "You must enter a valid domain name."; const string L_DomainNameMissingLabel_Text = "You must enter a valid domain name.";
const string L_AuthorizationFailureLabel_Text = "You arent authorized to log on to this connection. Contact your system administrator for authorization."; const string L_AuthorizationFailureLabel_Text = "You arent authorized to log on to this connection. Contact your system administrator for authorization.";
const string L_ServerConfigChangedLabel_Text = "Your RD Web Access session expired due to configuration changes on the remote computer. Please sign in again."; const string L_ServerConfigChangedLabel_Text = "Your RD Web Access session expired due to configuration changes on the remote computer. Please sign in again.";
@ -43,26 +46,23 @@
const string L_RenderFailP1_Text = "An unexpected error has occurred that is preventing this page from being displayed correctly."; const string L_RenderFailP1_Text = "An unexpected error has occurred that is preventing this page from being displayed correctly.";
const string L_RenderFailP2_Text = "Viewing this page in Internet Explorer with the Enhanced Security Configuration enabled can cause such an error."; const string L_RenderFailP2_Text = "Viewing this page in Internet Explorer with the Enhanced Security Configuration enabled can cause such an error.";
const string L_RenderFailP3_Text = "Please try loading this page without the Enhanced Security Configuration enabled. If this error continues to be displayed, please contact your administrator."; const string L_RenderFailP3_Text = "Please try loading this page without the Enhanced Security Configuration enabled. If this error continues to be displayed, please contact your administrator.";
const string L_GenericClaimsAuthErrorLabel_Text = "We can't sign you in right now. Please try again later.";
const string L_WrongAxVersionWarningLabel_Text = "You don't have the right version of Remote Desktop Connection to use RD Web Access.";
const string L_ClaimsDomainUserNameLabel_Text = "Username@domain:";
// //
// Page Variables // Page Variables
// //
public string strErrorMessageRowStyle; public string strErrorMessageRowStyle;
public bool bFailedLogon = false, bFailedAuthorization = false, bFailedAuthorizationOverride = false, bServerConfigChanged = false, bWorkspaceInUse = false, bWorkspaceDisconnected = false, bPasswordExpired = false, bPasswordExpiredNoChange = false; public string strDeliveryStyle;
public bool bFailedLogon = false, bFailedAuthorization = false, bServerConfigChanged = false, bWorkspaceInUse = false, bWorkspaceDisconnected = false, bPasswordExpired = false, bPasswordExpiredNoChange = false, bFailedSMSLogon = false, bFailedRadiusLogon = false, bOTP = false;
public string strWorkSpaceID = ""; public string strWorkSpaceID = "";
public string strRDPCertificates = ""; public string strRDPCertificates = "";
public string strRedirectorName = ""; public string strRedirectorName = "";
public string strClaimsHint = "";
public string strReturnUrl = ""; public string strReturnUrl = "";
public string strReturnUrlPage = ""; public string strReturnUrlPage = "";
public string strPasswordExpiredQueryString = ""; public string strPasswordExpiredQueryString = "";
public string strEventLogUploadAddress = "";
public string sHelpSourceServer, sLocalHelp; public string sHelpSourceServer, sLocalHelp;
public Uri baseUrl; public Uri baseUrl;
public bool bEnableSMS = false;
public bool bEnableMail = false;
public string strPrivateModeTimeout = "240"; public string strPrivateModeTimeout = "240";
public string strPublicModeTimeout = "20"; public string strPublicModeTimeout = "20";
@ -78,8 +78,9 @@
Response.End(); Response.End();
} }
// gives us https://<hostname>[:port]/rdweb/pages/<lang>/ // gives us https://<machine>/rdweb/pages/<lang>/
baseUrl = new Uri(new Uri(PageContentsHelper.GetBaseUri(Context), Request.FilePath), "."); // baseUrl = new Uri(new Uri(Request.Url, Request.FilePath), ".");
baseUrl = new Uri(new Uri(GetRealRequestUri(), Request.FilePath), ".");
sLocalHelp = ConfigurationManager.AppSettings["LocalHelp"]; sLocalHelp = ConfigurationManager.AppSettings["LocalHelp"];
if ((sLocalHelp != null) && (sLocalHelp == "true")) if ((sLocalHelp != null) && (sLocalHelp == "true"))
@ -99,17 +100,88 @@
catch (Exception objException) catch (Exception objException)
{ {
} }
try
{
if (ConfigurationManager.AppSettings["OTP"].ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase))
{
bOTP = true;
}
else
{
bOTP = false;
}
}
catch (Exception objException)
{
bOTP = false;
}
try
{
if (ConfigurationManager.AppSettings["EnableSMS"].ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase))
{
bEnableSMS = true;
}
else
{
bEnableSMS = false;
}
}
catch (Exception objException)
{
bEnableSMS = false;
}
try
{
if (ConfigurationManager.AppSettings["EnableMail"].ToString().Equals("true", StringComparison.CurrentCultureIgnoreCase))
{
bEnableMail = true;
}
else
{
bEnableMail = false;
}
}
catch (Exception objException)
{
bEnableMail = false;
}
} }
void Page_Load(object sender, EventArgs e) void Page_Load(object sender, EventArgs e)
{ {
if (!Page.IsPostBack)
{
Session["UserPass"] = "";
Session["DomainUserName"] = "";
}
if ( Request.QueryString != null ) if ( Request.QueryString != null )
{ {
NameValueCollection objQueryString = Request.QueryString; NameValueCollection objQueryString = Request.QueryString;
if ( objQueryString["ReturnUrl"] != null ) if ( objQueryString["ReturnUrl"] != null )
{ {
strReturnUrlPage = objQueryString["ReturnUrl"]; string strSmsToken = ConfigurationManager.AppSettings["SmsToken"];
strReturnUrl = "?ReturnUrl=" + HttpUtility.UrlEncode(strReturnUrlPage); if (strSmsToken == null || !(strSmsToken.Equals("true", StringComparison.CurrentCultureIgnoreCase)))
{
strReturnUrlPage = objQueryString["ReturnUrl"];
strReturnUrl = "?ReturnUrl=" + HttpUtility.UrlEncode(strReturnUrlPage);
}
else
{
strReturnUrlPage = objQueryString["ReturnUrl"].ToLower();
strReturnUrl = "?ReturnUrl=" + HttpUtility.UrlEncode(strReturnUrlPage.Replace("default.aspx", "smstoken.aspx"));
}
} }
if ( objQueryString["Error"] != null ) if ( objQueryString["Error"] != null )
{ {
@ -125,10 +197,13 @@
{ {
bFailedAuthorization = true; bFailedAuthorization = true;
} }
else if ( objQueryString["Error"].Equals("UnauthorizedAccessOverride", StringComparison.CurrentCultureIgnoreCase) ) else if (objQueryString["Error"].Equals("LoginSMSFailed", StringComparison.CurrentCultureIgnoreCase))
{ {
bFailedAuthorization = true; bFailedSMSLogon = true;
bFailedAuthorizationOverride = true; }
else if (objQueryString["Error"].Equals("LoginRadiusFailed", StringComparison.CurrentCultureIgnoreCase))
{
bFailedRadiusLogon = true;
} }
else if ( objQueryString["Error"].Equals("ServerConfigChanged", StringComparison.CurrentCultureIgnoreCase) ) else if ( objQueryString["Error"].Equals("ServerConfigChanged", StringComparison.CurrentCultureIgnoreCase) )
{ {
@ -182,7 +257,7 @@
if ( HttpContext.Current.User.Identity.IsAuthenticated != true ) if ( HttpContext.Current.User.Identity.IsAuthenticated != true )
{ {
// Only do this if we are actually rendering the login page, if we are just redirecting there is no need for these potentially expensive calls // Only do this if we are actually rendering the login page, if we are just redirecting there is no need for these potentially expensive calls
objWorkspaceInfo = PageContentsHelper.GetWorkspaceInfo(); objWorkspaceInfo = RdwaConfig.GetWorkspaceInfo();
if ( objWorkspaceInfo != null ) if ( objWorkspaceInfo != null )
{ {
strWorkSpaceID = objWorkspaceInfo.WorkspaceId; strWorkSpaceID = objWorkspaceInfo.WorkspaceId;
@ -192,18 +267,31 @@
{ {
L_CompanyName_Text = strWorkspaceName; L_CompanyName_Text = strWorkspaceName;
} }
if (!String.IsNullOrEmpty(objWorkspaceInfo.EventLogUploadAddress))
{
strEventLogUploadAddress = objWorkspaceInfo.EventLogUploadAddress;
}
} }
strRDPCertificates = PageContentsHelper.GetRdpSigningCertificateHash(); strRDPCertificates = RdwaConfig.GetRdpSigningCertificateHash();
strClaimsHint = PageContentsHelper.GetClaimsHint();
} }
if ( HttpContext.Current.User.Identity.IsAuthenticated == true ) if ( HttpContext.Current.User.Identity.IsAuthenticated == true )
{ {
SafeRedirect(strReturnUrlPage); // if ((string)Session["SMSTOKEN"] == "NOT_SMS_AUTH")
// {
// bFailedLogon = false;
// Session["SMSTOKEN"] = "";
// }
// else
// {
string strSmsToken = ConfigurationManager.AppSettings["SmsToken"];
if (strSmsToken == null || !(strSmsToken.Equals("true", StringComparison.CurrentCultureIgnoreCase)))
{
SafeRedirect(strReturnUrlPage);
}
else
{
Session["SMSTOKEN"] = "NOT_SMS_AUTH";
SafeRedirect(strReturnUrlPage);
}
// }
} }
else if ( HttpContext.Current.Request.HttpMethod.Equals("POST", StringComparison.CurrentCultureIgnoreCase) == true ) else if ( HttpContext.Current.Request.HttpMethod.Equals("POST", StringComparison.CurrentCultureIgnoreCase) == true )
{ {
@ -219,26 +307,44 @@
bFailedLogon = false; bFailedLogon = false;
} }
if (bFailedAuthorizationOverride)
{
bFailedLogon = false;
}
Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetCacheability(HttpCacheability.NoCache);
} }
public static Uri GetRealRequestUri()
{
if ((HttpContext.Current == null) ||
(HttpContext.Current.Request == null))
throw new ApplicationException("Cannot get current request.");
return GetRealRequestUri(HttpContext.Current.Request);
}
public static Uri GetRealRequestUri(HttpRequest request)
{
if (String.IsNullOrEmpty(request.Headers["Host"]))
return request.Url;
UriBuilder ub = new UriBuilder(request.Url);
string[] realHost = request.Headers["Host"].Split(':');
string host = realHost[0];
ub.Host = host;
string portString = realHost.Length > 1 ? realHost[1] : "";
int port;
if (int.TryParse(portString, out port))
ub.Port = port;
return ub.Uri;
}
private void SafeRedirect(string strRedirectUrl) private void SafeRedirect(string strRedirectUrl)
{ {
string strRedirectSafeUrl = null; string strRedirectSafeUrl = null;
if (!String.IsNullOrEmpty(strRedirectUrl)) if (!String.IsNullOrEmpty(strRedirectUrl))
{ {
Uri baseUrl = PageContentsHelper.GetBaseUri(Context); Uri redirectUri = new Uri(GetRealRequestUri(), strRedirectUrl);
Uri redirectUri = new Uri(new Uri(baseUrl, Request.FilePath), strRedirectUrl + PageContentsHelper.AppendTenantIdToQuery(String.Empty));
if ( if (
redirectUri.Authority.Equals(baseUrl.Authority) && redirectUri.Authority.Equals(Request.Url.Authority) &&
redirectUri.Scheme.Equals(baseUrl.Scheme) redirectUri.Scheme.Equals(Request.Url.Scheme)
) )
{ {
strRedirectSafeUrl = redirectUri.AbsoluteUri; strRedirectSafeUrl = redirectUri.AbsoluteUri;
@ -248,11 +354,26 @@
if (strRedirectSafeUrl == null) if (strRedirectSafeUrl == null)
{ {
strRedirectSafeUrl = "default.aspx" + PageContentsHelper.AppendTenantIdToQuery(String.Empty); string strSmsToken = ConfigurationManager.AppSettings["SmsToken"];
} if (strSmsToken == null || !(strSmsToken.Equals("true", StringComparison.CurrentCultureIgnoreCase)))
{
strRedirectSafeUrl = "default.aspx";
} else
{
string UserPass = Request.Form["UserPass"];
string DomainUserName =Request.Form["DomainUserName"];
string Delivery = Request.Form["rDelivery"];
Session["UserPass"] = UserPass;
Session["DomainUserName"]= DomainUserName;
Session["Delivery"] = Delivery;
strRedirectSafeUrl = "smstoken.aspx";
}
}
Response.Redirect(strRedirectSafeUrl); Response.Redirect(strRedirectSafeUrl);
} }
</script> </script>
<RDWAPage <RDWAPage
helpurl="<%=sHelpSourceServer%>" helpurl="<%=sHelpSourceServer%>"
@ -278,35 +399,21 @@
onunload="onPageUnload(event)"/> onunload="onPageUnload(event)"/>
<HTMLMainContent> <HTMLMainContent>
<form id="FrmLogin" name="FrmLogin" action="login.aspx<%=SecurityElement.Escape(PageContentsHelper.AppendTenantIdToQuery(strReturnUrl))%>" method="post" onsubmit="return onLoginFormSubmit()"> <form id="FrmLogin" name="FrmLogin" action="login.aspx<%=SecurityElement.Escape(strReturnUrl)%>" method="post" onsubmit="return onLoginFormSubmit()">
<input type="hidden" name="WorkSpaceID" value="<%=SecurityElement.Escape(strWorkSpaceID)%>"/> <input type="hidden" name="WorkSpaceID" value="<%=SecurityElement.Escape(strWorkSpaceID)%>"/>
<input type="hidden" name="RDPCertificates" value="<%=SecurityElement.Escape(strRDPCertificates)%>"/> <input type="hidden" name="RDPCertificates" value="<%=SecurityElement.Escape(strRDPCertificates)%>"/>
<input type="hidden" name="PublicModeTimeout" value="<%=SecurityElement.Escape(strPublicModeTimeout)%>"/> <input type="hidden" name="PublicModeTimeout" value="<%=SecurityElement.Escape(strPublicModeTimeout)%>"/>
<input type="hidden" name="PrivateModeTimeout" value="<%=SecurityElement.Escape(strPrivateModeTimeout)%>"/> <input type="hidden" name="PrivateModeTimeout" value="<%=SecurityElement.Escape(strPrivateModeTimeout)%>"/>
<input type="hidden" name="WorkspaceFriendlyName" value="<%=SecurityElement.Escape(L_CompanyName_Text)%>"/> <input type="hidden" name="WorkspaceFriendlyName" value="<%=SecurityElement.Escape(L_CompanyName_Text)%>"/>
<input type="hidden" name="EventLogUploadAddress" value="<%=SecurityElement.Escape(strEventLogUploadAddress)%>"/>
<input type="hidden" name="RedirectorName" value="<%=SecurityElement.Escape(strRedirectorName)%>"/> <input type="hidden" name="RedirectorName" value="<%=SecurityElement.Escape(strRedirectorName)%>"/>
<input type="hidden" name="ClaimsHint" value="<%=SecurityElement.Escape(strClaimsHint)%>"/>
<input type="hidden" name="ClaimsToken" value=""/>
<input name="isUtf8" type="hidden" value="1"/> <input name="isUtf8" type="hidden" value="1"/>
<input type="hidden" name="flags" value="0"/> <input type="hidden" name="flags" value="0"/>
<table id="tableLoginDisabled" width="300" border="0" align="center" cellpadding="0" cellspacing="0" style="display:none">
<tr>
<td height="20">&#160;</td>
</tr>
<tr>
<td><span class="wrng"><%=L_WrongAxVersionWarningLabel_Text%></span></td>
</tr>
<tr>
<td height="50">&#160;</td>
</tr>
</table>
<table id="tableLoginForm" width="300" border="0" align="center" cellpadding="0" cellspacing="0" style="display:none"> <table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
<tr> <tr>
<td height="20">&#160;</td> <td height="20">&#160;</td>
@ -316,8 +423,7 @@
<td> <td>
<table width="300" border="0" cellpadding="0" cellspacing="0"> <table width="300" border="0" cellpadding="0" cellspacing="0">
<tr> <tr>
<td id="tdDomainUserNameLabel" width="130" align="right" style="display:none"><%=L_DomainUserNameLabel_Text%></td> <td width="130" align="right"><%=L_DomainUserNameLabel_Text%></td>
<td id="tdClaimsDomainUserNameLable" width="130" align="right" style="display:none"><%=L_ClaimsDomainUserNameLabel_Text%></td>
<td width="7"></td> <td width="7"></td>
<td align="right"> <td align="right">
<label><input id="DomainUserName" name="DomainUserName" type="text" class="textInputField" runat="server" size="25" autocomplete="off" /></label> <label><input id="DomainUserName" name="DomainUserName" type="text" class="textInputField" runat="server" size="25" autocomplete="off" /></label>
@ -344,6 +450,42 @@
</td> </td>
</tr> </tr>
<%
strDeliveryStyle = "style=\"display:none\"";
if ( bOTP )
{
strDeliveryStyle = "style=\"display:\"";
}
%>
<td height="7"></td>
<tr id="trDelivery" <%=strDeliveryStyle%> >
<td>
<table width="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="105" align="right">Token delivery:</td>
<td width="7"></td>
<td align="left" width="170">
<% if (bEnableSMS == true) { %>
<label> <input name="rDelivery" type="radio" size="25" value="SMS"
checked="checked"/>SMS</label>
<%} %>
<% if (bEnableMail == true) { %>
<% if (bEnableSMS == true) { %>
<label> <input name="rDelivery" type="radio" size="25" value="EMAIL"/>E-Mail </label>
<%} else { %>
<label> <input name="rDelivery" type="radio" size="25" value="EMAIL" checked="checked"/>E-Mail </label>
<%} %>
<%} %>
</td>
</tr>
</table>
</td>
</tr>
<% <%
strErrorMessageRowStyle = "style=\"display:none\""; strErrorMessageRowStyle = "style=\"display:none\"";
if ( bPasswordExpiredNoChange == true) if ( bPasswordExpiredNoChange == true)
@ -424,6 +566,46 @@
</td> </td>
</tr> </tr>
<%
strErrorMessageRowStyle = "style=\"display:none\"";
if ( bFailedSMSLogon == true )
{
strErrorMessageRowStyle = "style=\"display:\"";
}
%>
<tr id="tr1" <%=strErrorMessageRowStyle%> >
<td>
<table>
<tr>
<td height="20">&#160;</td>
</tr>
<tr>
<td><span class="wrng"><%=L_LogonSMSFailureLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<%
strErrorMessageRowStyle = "style=\"display:none\"";
if ( bFailedRadiusLogon == true )
{
strErrorMessageRowStyle = "style=\"display:\"";
}
%>
<tr id="tr2" <%=strErrorMessageRowStyle%> >
<td>
<table>
<tr>
<td height="20">&#160;</td>
</tr>
<tr>
<td><span class="wrng"><%=L_LogonRadiusFailureLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<% <%
strErrorMessageRowStyle = "style=\"display:none\""; strErrorMessageRowStyle = "style=\"display:none\"";
if ( bFailedLogon == true ) if ( bFailedLogon == true )
@ -457,9 +639,11 @@
</td> </td>
</tr> </tr>
<% <%
strErrorMessageRowStyle = "style=\"display:none\""; strErrorMessageRowStyle = "style=\"display:none\"";
if ( bFailedAuthorization || bFailedAuthorizationOverride ) if ( bFailedAuthorization )
{ {
strErrorMessageRowStyle = "style=\"display:\""; strErrorMessageRowStyle = "style=\"display:\"";
} }
@ -497,19 +681,6 @@
</td> </td>
</tr> </tr>
<tr id="trErrorGenericClaimsAuthFailure" style="display:none" >
<td>
<table>
<tr>
<td height="20">&#160;</td>
</tr>
<tr>
<td><span class="wrng"><%=L_GenericClaimsAuthErrorLabel_Text%></span></td>
</tr>
</table>
</td>
</tr>
<tr> <tr>
<td height="20">&#160;</td> <td height="20">&#160;</td>
</tr> </tr>
@ -543,8 +714,8 @@
<td><%=L_PublicLabel_Text%></td> <td><%=L_PublicLabel_Text%></td>
</tr> </tr>
<tr id="trPubExp" style="display:none" > <tr id="trPubExp" style="display:none" >
<td width="30"></td> <td width="30"></td>
<td><span class="expl"><%=L_PublicExplanationLabel_Text%></span></td> <td><span class="expl"><%=L_PublicExplanationLabel_Text%></span></td>
</tr> </tr>
<tr> <tr>
<td height="7"></td> <td height="7"></td>
@ -563,8 +734,8 @@
<td><%=L_PrivateLabel_Text%></td> <td><%=L_PrivateLabel_Text%></td>
</tr> </tr>
<tr id="trPrvtExp" style="display:none" > <tr id="trPrvtExp" style="display:none" >
<td width="30"></td> <td width="30"></td>
<td><span class="expl"><%=L_PrivateExplanationLabel_Text%></span></td> <td><span class="expl"><%=L_PrivateExplanationLabel_Text%></span></td>
</tr> </tr>
<tr> <tr>
<td height="7"></td> <td height="7"></td>

View file

@ -15,7 +15,7 @@
if ( HttpContext.Current.User.Identity.IsAuthenticated == true ) if ( HttpContext.Current.User.Identity.IsAuthenticated == true )
{ {
Response.Redirect( "default.aspx" + AppendTenantIdToQuery(String.Empty) ); Response.Redirect( "default.aspx" );
} }
else else
{ {
@ -32,34 +32,19 @@
else if ( objQueryString["Error"].Equals("WkSDisconnected", StringComparison.CurrentCultureIgnoreCase) ) else if ( objQueryString["Error"].Equals("WkSDisconnected", StringComparison.CurrentCultureIgnoreCase) )
{ {
strQueryString = "?Error=WkSDisconnected"; strQueryString = "?Error=WkSDisconnected";
}
else if ( objQueryString["Error"].Equals("LoginSMSFailed", StringComparison.CurrentCultureIgnoreCase) )
{
strQueryString = "?Error=LoginSMSFailed";
}
else if ( objQueryString["Error"].Equals("LoginRadiusFailed", StringComparison.CurrentCultureIgnoreCase) )
{
strQueryString = "?Error=LoginRadiusFailed";
} }
} }
} }
Response.Redirect( "login.aspx" + AppendTenantIdToQuery(strQueryString) ); Response.Redirect( "login.aspx" + strQueryString );
} }
} }
// BUGBUG: Temporary workaround while we need to expose the tenant ID as a query string to end-users
private const string tenantIdLabel = "tenantId";
public static string AppendTenantIdToQuery(string strQueryString)
{
if(HttpContext.Current.Request.QueryString != null)
{
if(!String.IsNullOrEmpty(HttpContext.Current.Request.QueryString[tenantIdLabel]))
{
string strTenantIdParams = tenantIdLabel + "=" + HttpUtility.UrlEncode(HttpContext.Current.Request.QueryString[tenantIdLabel]);
if(String.IsNullOrEmpty(strQueryString))
{
return "?" + strTenantIdParams;
}
else
{
return strQueryString + "&" + strTenantIdParams;
}
}
}
return strQueryString;
}
</script> </script>

Binary file not shown.

View file

@ -0,0 +1,33 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="token.aspx.cs" Inherits="Pages_en_US_token" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function doSomething() {
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label" Visible="False"></asp:Label>
</div>
</form>
</body>
</html>

View file

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RadiusClient;
using System.Configuration;
public partial class Pages_en_US_token : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string tmpUser = Request.QueryString["User"];
string DomainUserName = tmpUser.Replace("UserName:s:", "");
// Label1.Text = DomainUserName;
HttpCookie myCookie = new HttpCookie("RadiusSessionId");
myCookie = Request.Cookies["RadiusSessionId"];
// Read the cookie information and display it.
if (myCookie != null)
{
string RadiusServer = ConfigurationManager.AppSettings["RadiusServer"];
string RadiusSecret = ConfigurationManager.AppSettings["RadiusSecret"];
Radius_Client myRadius = new Radius_Client(RadiusServer, 1812);
RADIUSPacket rp = default(RADIUSPacket);
VendorSpecificAttribute vsa = new VendorSpecificAttribute(VendorSpecificType.Generic, "LAUNCH");
RADIUSAttributes atts = new RADIUSAttributes();
// Dim ost As New RADIUSAttribute(RadiusAttributeType.VendorSpecific, att.VendorName & att.VendorType & att.VendorValue)
vsa.SetRADIUSAttribute(ref atts);
// RADIUSAttribute AppLaunch = new RADIUSAttribute(RadiusAttributeType.VendorSpecific, "LAUNCH");
//RADIUSAttribute AppLaunch = new RADIUSAttribute(RadiusAttributeType.VendorSpecific, att.VendorName + att.VendorType + att.VendorValue);
// atts.Add(AppLaunch);
// myRadius.Debug = true;
try
{
rp = myRadius.Authenticate(RadiusSecret, DomainUserName, myCookie.Value, atts);
if ((int)rp.Code == 2)
{
Response.Write("Ready to launch application. Granted access!");
}
else
{
Response.Write("Failure to authenticate session launch");
}
}
catch (Exception ex)
{
Response.Write("Exception!! failure. " + ex.Message);
}
// Response.Write("<p>" + myCookie.Name + "<p>" + myCookie.Value);
}
else
{
// redrect to login Response.Write("not found");
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before After
Before After

View file

@ -4,7 +4,6 @@ var strTransparentGif = "../images/clear.gif";
var g_objWorkspace = null; var g_objWorkspace = null;
var g_activeXSSOMode = false; var g_activeXSSOMode = false;
var g_activeXSSOModeSet = false; var g_activeXSSOModeSet = false;
var g_workspaceObjectVersion = -1;
var bFormAuthenticationMode = false; var bFormAuthenticationMode = false;
var iSessionTimeout = 0; var iSessionTimeout = 0;
var iConstSecToMilliSec = 1000; var iConstSecToMilliSec = 1000;
@ -94,11 +93,11 @@ function onAuthenticatedPageload(e)
function onClickHelp() function onClickHelp()
{ {
if ( helpPopup == null || helpPopup.closed == true ) if ( helpPopup == null || helpPopup.closed == true )
{ {
helpPopup = window.open( sHelpSource, helpPopup = window.open( sHelpSource,
"_blank", "_blank",
"height=600px, width=600px, left=600, top=150, toolbar=no, resizable=yes, scrollbars=yes, menubar=no" ); "height=600px, width=600px, left=600, top=150, toolbar=no, resizable=yes, scrollbars=yes, menubar=no" );
} }
else else
{ {
@ -107,6 +106,125 @@ function onClickHelp()
} }
} }
function onLoginFormSubmit()
{
var bStopSubmission = false;
var iErrorCode;
var objWorkspace = null;
var objForm = document.getElementById("FrmLogin");
var strDomainName = null;
var strDomainUserName = "";
var strPassword = "";
var strWorkspaceId = "";
var strWorkspaceFriendlyName = "";
var strRedirectorName = "";
var strRDPCertificates = "";
var bPrivateMode = document.getElementById("rdoPrvt").checked;
var strTimeout = "0";
hideElement(document.getElementById("trErrorWorkSpaceInUse"));
hideElement(document.getElementById("trErrorWorkSpaceDisconnected"));
hideElement(document.getElementById("trErrorIncorrectCredentials"));
hideElement(document.getElementById("trErrorDomainNameMissing"));
hideElement(document.getElementById("trErrorUnauthorizedAccess"));
hideElement(document.getElementById("trErrorServerConfigChanged"));
if ( objForm != null )
{
strDomainUserName = objForm.elements["DomainUserName"].value;
strPassword = objForm.elements["UserPass"].value;
strWorkspaceId = objForm.elements["WorkSpaceID"].value;
strRDPCertificates = objForm.elements["RDPCertificates"].value;
strWorkspaceFriendlyName = objForm.elements["WorkspaceFriendlyName"].value;
strRedirectorName = objForm.elements["RedirectorName"].value;
if( bPrivateMode )
{
strTimeout = objForm.elements["PrivateModeTimeout"].value;
}
else
{
strTimeout = objForm.elements["PublicModeTimeout"].value;
}
if ( -1 != strDomainUserName.indexOf("\\") )
{
strDomainName = strDomainUserName.substring( 0, strDomainUserName.indexOf("\\") );
}
else if ( -1 != strDomainUserName.indexOf("@") )
{
strDomainName = strDomainUserName.substring( strDomainUserName.indexOf("@") + 1, strDomainUserName.length );
}
}
if ( strDomainUserName == null || strDomainUserName == "" ||
strPassword == null || strPassword == "" )
{
showElement(document.getElementById("trErrorIncorrectCredentials"));
bStopSubmission = true;
}
else if ( strDomainName == null || strDomainName == "" || strDomainName == "." )
{
showElement(document.getElementById("trErrorDomainNameMissing"));
bStopSubmission = true;
}
else
{
if (strWorkspaceId != null &&
strWorkspaceId != "" &&
GetActiveXSSOMode())
{
try
{
objWorkspace = GetWorkspaceObject2();
if (objWorkspace != null)
{
objWorkspace.StartWorkspaceEx(
strWorkspaceId,
strWorkspaceFriendlyName,
strRedirectorName,
strDomainUserName,
strPassword,
strRDPCertificates,
parseInt(strTimeout),
0 );
}
else
{
objWorkspace = GetWorkspaceObject();
objWorkspace.StartWorkspace(
strWorkspaceId,
strDomainUserName,
strPassword,
strRDPCertificates,
parseInt(strTimeout),
0);
}
}
catch (objException)
{
objWorkspace = null;
iErrorCode = (objException.number & 0xFFFF);
//
// 183 = ERROR_ALREADY_EXISTS.
//
if ( iErrorCode == 183 )
{
showElement(document.getElementById("trErrorWorkSpaceInUse"));
bStopSubmission = true;
}
}
}
}
// return false to stop form submission
return !bStopSubmission;
}
function onAutoDisconnect() function onAutoDisconnect()
{ {
if ( bAsyncPageRequestSucceeded ) if ( bAsyncPageRequestSucceeded )
@ -140,7 +258,7 @@ function onAutoDisconnect()
} }
} }
window.location = strBaseUrl + "LogOff.aspx" + window.location.search; window.location = strBaseUrl + "LogOff.aspx";
} }
function onUserDisconnect() function onUserDisconnect()
@ -171,7 +289,7 @@ function onUserDisconnect()
} }
} }
window.location = strBaseUrl + "LogOff.aspx" + window.location.search; window.location = strBaseUrl + "LogOff.aspx";
} }
function onClickSecurity() { function onClickSecurity() {
@ -298,6 +416,66 @@ function getCookieCrumbValue(strCookieContents, strCookieCrumbName)
return strCookieCrumbValue; return strCookieCrumbValue;
} }
function onLoginPageLoad(e)
{
var strDomainUserName = ""; // CrumbName: Name
var strMachineType = ""; // CrumbName: MachineType
var strWorkSpaceID = ""; // CrumbName: WorkSpaceID
var strCookieContents = "";
var iIndex;
var bActiveXSSOMode = GetActiveXSSOMode(); // as a side-effect, this caches the workspace ActiveX object
onPageload(e); // call the parent event
if (bActiveXSSOMode) {
document.getElementById("tablePublicOption").style.display = "";
document.getElementById("tablePrivateOption").style.display = "";
document.getElementById("spanToggleSecExplanation").style.display = "";
document.getElementById("rdoPblc").checked = true;
}
else {
document.getElementById("trPrvtWrnNoAx").style.display = "";
}
onClickSecurity();
strCookieContents = getCookieContents(strTSWACookieName);
if ( null != strCookieContents )
{
strDomainUserName = decodeURIComponent( getCookieCrumbValue(strCookieContents, "Name") );
strMachineType = getCookieCrumbValue(strCookieContents, "MachineType");
strWorkSpaceID = decodeURIComponent( getCookieCrumbValue(strCookieContents, "WorkSpaceID") );
if ( strMachineType != "" &&
strMachineType == "private")
{
document.getElementById("DomainUserName").value = strDomainUserName;
document.getElementById("rdoPrvt").checked = "private";
onClickSecurity();
}
//
// Set focus on UserName or Password field.
//
if ( strDomainUserName != "" )
{
document.getElementById("UserPass").focus();
}
else
{
document.getElementById("DomainUserName").focus();
}
}
else
{
document.getElementById("DomainUserName").focus();
}
}
function onAuthenticated() function onAuthenticated()
{ {
var iErrorCode; var iErrorCode;
@ -324,11 +502,6 @@ function onAuthenticated()
return; return;
} }
var strQueryStringPreamble = "?";
if (window.location.search) {
strQueryStringPreamble = window.location.search + "&";
}
if ( strDomainUserName.toLowerCase() == strLoggedOnDomainUserName.toLowerCase()) { if ( strDomainUserName.toLowerCase() == strLoggedOnDomainUserName.toLowerCase()) {
if (GetActiveXSSOMode()) { if (GetActiveXSSOMode()) {
try { try {
@ -349,13 +522,13 @@ function onAuthenticated()
// 183 = ERROR_ALREADY_EXISTS. // 183 = ERROR_ALREADY_EXISTS.
// //
if (iErrorCode == 183) { if (iErrorCode == 183) {
window.location = strBaseUrl + "LogOff.aspx" + strQueryStringPreamble + "Error=WkSInUse"; window.location = strBaseUrl + "LogOff.aspx?Error=WkSInUse";
} }
// //
// 1168 = ERROR_NOT_FOUND. // 1168 = ERROR_NOT_FOUND.
// //
if (iErrorCode == 1168) { if (iErrorCode == 1168) {
window.location = strBaseUrl + "LogOff.aspx" + strQueryStringPreamble + "Error=WkSDisconnected"; window.location = strBaseUrl + "LogOff.aspx?Error=WkSDisconnected";
} }
} }
} }
@ -366,47 +539,42 @@ function onAuthenticated()
// //
// Ideally check workspace state before redirecting; if it has been authenticatd as well. // Ideally check workspace state before redirecting; if it has been authenticatd as well.
// //
window.location = strBaseUrl + "LogOff.aspx" + strQueryStringPreamble + "Error=WkSInUse"; window.location = strBaseUrl + "LogOff.aspx?Error=WkSInUse";
} }
} }
} }
function GetWorkspaceObject() function GetWorkspaceObject()
{ {
var objClientShell = null;
if( g_objWorkspace == null ) if( g_objWorkspace == null )
{ {
var objClientShell = new ActiveXObject("MsRdpWebAccess.MsRdpClientShell"); g_objWorkspace = GetWorkspaceObject2();
g_objWorkspace = objClientShell.MsRdpWorkspace3; if (g_objWorkspace == null)
if(g_objWorkspace != null)
{ {
g_workspaceObjectVersion = 3; objClientShell = new ActiveXObject("MsRdpWebAccess.MsRdpClientShell");
} g_objWorkspace = objClientShell.MsRdpWorkspace;
else
{
g_objWorkspace = objClientShell.MsRdpWorkspace2;
if(g_objWorkspace != null)
{
g_workspaceObjectVersion = 2;
}
else
{
g_objWorkspace = objClientShell.MsRdpWorkspace;
if(g_objWorkspace != null)
{
g_workspaceObjectVersion = 1;
}
else
{
g_workspaceObjectVersion = 0;
}
}
} }
} }
return g_objWorkspace; return g_objWorkspace;
} }
function GetWorkspaceObject2()
{
var objClientShell = null;
g_objWorkspace = null;
objClientShell = new ActiveXObject("MsRdpWebAccess.MsRdpClientShell");
g_objWorkspace = objClientShell.MsRdpWorkspace2;
return g_objWorkspace;
}
function GetActiveXSSOMode() { function GetActiveXSSOMode() {
if (!g_activeXSSOModeSet) { if (!g_activeXSSOModeSet) {
@ -426,19 +594,6 @@ function GetActiveXSSOMode() {
return g_activeXSSOMode; return g_activeXSSOMode;
} }
function GetWorkspaceObjectVersion()
{
if (g_workspaceObjectVersion == -1) {
try {
GetWorkspaceObject();
}
catch (objException) {
}
}
return g_workspaceObjectVersion;
}
function ApplyPngTransparency() function ApplyPngTransparency()
{ {
var objDocumentElements = document.all; var objDocumentElements = document.all;

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://schemas.microsoft.com/ts/2007/05/tswf" elementFormDefault="qualified" xmlns="http://schemas.microsoft.com/ts/2007/05/tswf" xmlns:mstns="http://schemas.microsoft.com/ts/2007/05/tswf" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.1"> <xs:schema targetNamespace="http://schemas.microsoft.com/ts/2007/05/tswf" elementFormDefault="qualified" xmlns="http://schemas.microsoft.com/ts/2007/05/tswf" xmlns:mstns="http://schemas.microsoft.com/ts/2007/05/tswf" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="2.0">
<xs:element name="ResourceCollection" type="ResourceCollectionType" /> <xs:element name="ResourceCollection" type="ResourceCollectionType" />
<xs:complexType name="ResourceCollectionType"> <xs:complexType name="ResourceCollectionType">
<xs:sequence> <xs:sequence>
@ -113,7 +113,6 @@
</xs:attribute> </xs:attribute>
<xs:attribute name="RequiredCommandLine" type="xs:string" /> <xs:attribute name="RequiredCommandLine" type="xs:string" />
<xs:attribute name="ExecutableName" type="xs:string" /> <xs:attribute name="ExecutableName" type="xs:string" />
<xs:attribute name="ShowByDefault" type="xs:boolean" />
<xs:anyAttribute processContents="lax" /> <xs:anyAttribute processContents="lax" />
</xs:complexType> </xs:complexType>
<xs:complexType name="IconType"> <xs:complexType name="IconType">