mirror of
https://github.com/jakobadam/RDSFactor.git
synced 2025-07-25 18:58:15 +02:00
Updated RDWeb pages with the two-factor support
This commit is contained in:
parent
80da1889a3
commit
59d9b4b135
24 changed files with 735 additions and 229 deletions
|
@ -34,7 +34,7 @@
|
|||
public bool bShowOptimizeExperience = false, bOptimizeExperienceState = false;
|
||||
public AuthenticationMode eAuthenticationMode = AuthenticationMode.None;
|
||||
public string strTicketName = "";
|
||||
public string strDomainUserName = "", strUserIdentity = "";
|
||||
public string strDomainUserName = "", strUserSID = "";
|
||||
public string strAppFeed;
|
||||
|
||||
public WorkspaceInfo objWorkspaceInfo = null;
|
||||
|
@ -45,9 +45,9 @@
|
|||
string strReturnUrl = "";
|
||||
string strReturnUrlPage = "";
|
||||
|
||||
// gives us https://<hostname>[:port]/rdweb/pages/<lang>/
|
||||
baseUrl = new Uri(new Uri(PageContentsHelper.GetBaseUri(Context), Request.FilePath), ".");
|
||||
|
||||
// gives us https://<machine>/rdweb/pages/<lang>/
|
||||
// baseUrl = new Uri(new Uri(Request.Url, Request.FilePath), ".");
|
||||
baseUrl = new Uri(new Uri(GetRealRequestUri(), Request.FilePath), ".");
|
||||
try
|
||||
{
|
||||
string strShowOptimzeExperienceValue = ConfigurationManager.AppSettings["ShowOptimizeExperience"];
|
||||
|
@ -90,25 +90,25 @@
|
|||
|
||||
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))
|
||||
{
|
||||
strQueryString = "?ReturnUrl=" + Request.Path;
|
||||
|
||||
Response.Redirect(new Uri(baseUrl,"login.aspx?ReturnUrl=" + Request.Path).AbsoluteUri);
|
||||
}
|
||||
else
|
||||
{
|
||||
strQueryString = strReturnUrl;
|
||||
|
||||
Response.Redirect(new Uri(baseUrl, "login.aspx" + strReturnUrl).AbsoluteUri);
|
||||
}
|
||||
|
||||
Response.Redirect(new Uri(baseUrl, "login.aspx" + PageContentsHelper.AppendTenantIdToQuery(strQueryString)).AbsoluteUri);
|
||||
}
|
||||
|
||||
TSFormAuthTicketInfo objTSFormAuthTicketInfo = new TSFormAuthTicketInfo(HttpContext.Current);
|
||||
strUserIdentity = objTSFormAuthTicketInfo.UserIdentity;
|
||||
strUserSID = objTSFormAuthTicketInfo.UserSid;
|
||||
bPrivateMode = objTSFormAuthTicketInfo.PrivateMode;
|
||||
strDomainUserName = objTSFormAuthTicketInfo.DomainUserName;
|
||||
|
||||
|
||||
if ( bPrivateMode == true )
|
||||
{
|
||||
|
@ -163,9 +163,9 @@
|
|||
WebFeed tswf = null;
|
||||
try
|
||||
{
|
||||
tswf = new WebFeed(RdpType.Both, true);
|
||||
tswf = new WebFeed(RdpType.Both);
|
||||
strAppFeed = tswf.GenerateFeed(
|
||||
strUserIdentity,
|
||||
strUserSID,
|
||||
FeedXmlVersion.Win8,
|
||||
(Request.PathInfo.Length > 0) ? Request.PathInfo : "/",
|
||||
false);
|
||||
|
@ -174,11 +174,6 @@
|
|||
{
|
||||
BadFolderRedirect();
|
||||
}
|
||||
catch (InvalidTenantException)
|
||||
{
|
||||
Response.StatusCode = 404;
|
||||
Response.End();
|
||||
}
|
||||
catch (WorkspaceUnavailableException wue)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
Response.ContentType = "text/html";
|
||||
|
@ -217,11 +236,14 @@
|
|||
</head>
|
||||
<body>
|
||||
<p id=""BadFolder1"">" + L_BadFolderErrorBody_Text + @"</p>
|
||||
|
||||
</body>
|
||||
</html>");
|
||||
Response.End();
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<%="<?xml-stylesheet type=\"text/xsl\" href=\"" + SecurityElement.Escape(stylesheetUrl.AbsoluteUri) + "\"?>"%>
|
||||
<%="<?xml-stylesheet type=\"text/css\" href=\"" + SecurityElement.Escape(renderFailCssUrl.AbsoluteUri) + "\"?>"%>
|
||||
|
@ -242,6 +264,7 @@
|
|||
<p><%=L_RenderFailP1_Text%></p>
|
||||
<p><%=L_RenderFailP2_Text%></p>
|
||||
<p><%=L_RenderFailP3_Text%></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</RenderFailureMessage>
|
||||
|
@ -518,6 +541,7 @@
|
|||
background-color:white;
|
||||
}
|
||||
</Style>
|
||||
|
||||
<AppFeed
|
||||
showpubliccheckbox="<%=bShowPublicCheckBox.ToString().ToLower()%>"
|
||||
privatemode="<%=bPrivateMode.ToString().ToLower()%>"
|
||||
|
@ -531,6 +555,9 @@
|
|||
}
|
||||
%>
|
||||
>
|
||||
|
||||
<%=strAppFeed%>
|
||||
|
||||
</AppFeed>
|
||||
|
||||
</RDWAPage>
|
||||
|
|
|
@ -108,8 +108,8 @@
|
|||
Response.End();
|
||||
}
|
||||
|
||||
// gives us https://<hostname>[:port]/rdweb/pages/<lang>/
|
||||
baseUrl = new Uri(new Uri(PageContentsHelper.GetBaseUri(Context), Request.FilePath), ".");
|
||||
// gives us https://<machine>/rdweb/pages/<lang>/
|
||||
baseUrl = new Uri(new Uri(Request.Url, Request.FilePath), ".");
|
||||
|
||||
AuthenticationSection objAuthenticationSection = ConfigurationManager.GetSection("system.web/authentication") as AuthenticationSection;
|
||||
if ( objAuthenticationSection != null )
|
||||
|
@ -155,7 +155,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
objWorkspaceInfo = PageContentsHelper.GetWorkspaceInfo();
|
||||
objWorkspaceInfo = RdwaConfig.GetWorkspaceInfo();
|
||||
if ( objWorkspaceInfo != null )
|
||||
{
|
||||
string strWorkspaceName = objWorkspaceInfo.WorkspaceName;
|
||||
|
|
16
RDSFactorWeb/RDWeb/Pages/en-US/cook.aspx
Normal file
16
RDSFactorWeb/RDWeb/Pages/en-US/cook.aspx
Normal 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>
|
24
RDSFactorWeb/RDWeb/Pages/en-US/cook.aspx.cs
Normal file
24
RDSFactorWeb/RDWeb/Pages/en-US/cook.aspx.cs
Normal 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.");
|
||||
}
|
||||
}
|
|
@ -6,13 +6,14 @@
|
|||
<% @Import Namespace="System.Security" %>
|
||||
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication" %>
|
||||
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal" %>
|
||||
<% @Import Namespace="RadiusClient" %>
|
||||
<script language="C#" runat=server>
|
||||
|
||||
//
|
||||
// Customizable Text
|
||||
//
|
||||
string L_CompanyName_Text = "Work Resources";
|
||||
|
||||
|
||||
//
|
||||
// Localizable Text
|
||||
//
|
||||
|
@ -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_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_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_AuthorizationFailureLabel_Text = "You aren’t 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.";
|
||||
|
@ -42,27 +45,24 @@
|
|||
const string L_RenderFailTitle_Text = "Error: Unable to display RD Web Access";
|
||||
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_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:";
|
||||
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.";
|
||||
|
||||
//
|
||||
// Page Variables
|
||||
//
|
||||
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 strRDPCertificates = "";
|
||||
public string strRedirectorName = "";
|
||||
public string strClaimsHint = "";
|
||||
public string strReturnUrl = "";
|
||||
public string strReturnUrlPage = "";
|
||||
public string strPasswordExpiredQueryString = "";
|
||||
public string strEventLogUploadAddress = "";
|
||||
public string sHelpSourceServer, sLocalHelp;
|
||||
public Uri baseUrl;
|
||||
|
||||
public bool bEnableSMS = false;
|
||||
public bool bEnableMail = false;
|
||||
public string strPrivateModeTimeout = "240";
|
||||
public string strPublicModeTimeout = "20";
|
||||
|
||||
|
@ -78,8 +78,9 @@
|
|||
Response.End();
|
||||
}
|
||||
|
||||
// gives us https://<hostname>[:port]/rdweb/pages/<lang>/
|
||||
baseUrl = new Uri(new Uri(PageContentsHelper.GetBaseUri(Context), Request.FilePath), ".");
|
||||
// gives us https://<machine>/rdweb/pages/<lang>/
|
||||
// baseUrl = new Uri(new Uri(Request.Url, Request.FilePath), ".");
|
||||
baseUrl = new Uri(new Uri(GetRealRequestUri(), Request.FilePath), ".");
|
||||
|
||||
sLocalHelp = ConfigurationManager.AppSettings["LocalHelp"];
|
||||
if ((sLocalHelp != null) && (sLocalHelp == "true"))
|
||||
|
@ -99,17 +100,88 @@
|
|||
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)
|
||||
{
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
Session["UserPass"] = "";
|
||||
Session["DomainUserName"] = "";
|
||||
}
|
||||
|
||||
if ( Request.QueryString != null )
|
||||
{
|
||||
NameValueCollection objQueryString = Request.QueryString;
|
||||
if ( objQueryString["ReturnUrl"] != null )
|
||||
{
|
||||
strReturnUrlPage = objQueryString["ReturnUrl"];
|
||||
strReturnUrl = "?ReturnUrl=" + HttpUtility.UrlEncode(strReturnUrlPage);
|
||||
string strSmsToken = ConfigurationManager.AppSettings["SmsToken"];
|
||||
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 )
|
||||
{
|
||||
|
@ -125,10 +197,13 @@
|
|||
{
|
||||
bFailedAuthorization = true;
|
||||
}
|
||||
else if ( objQueryString["Error"].Equals("UnauthorizedAccessOverride", StringComparison.CurrentCultureIgnoreCase) )
|
||||
else if (objQueryString["Error"].Equals("LoginSMSFailed", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
bFailedAuthorization = true;
|
||||
bFailedAuthorizationOverride = true;
|
||||
bFailedSMSLogon = true;
|
||||
}
|
||||
else if (objQueryString["Error"].Equals("LoginRadiusFailed", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
bFailedRadiusLogon = true;
|
||||
}
|
||||
else if ( objQueryString["Error"].Equals("ServerConfigChanged", StringComparison.CurrentCultureIgnoreCase) )
|
||||
{
|
||||
|
@ -182,7 +257,7 @@
|
|||
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
|
||||
objWorkspaceInfo = PageContentsHelper.GetWorkspaceInfo();
|
||||
objWorkspaceInfo = RdwaConfig.GetWorkspaceInfo();
|
||||
if ( objWorkspaceInfo != null )
|
||||
{
|
||||
strWorkSpaceID = objWorkspaceInfo.WorkspaceId;
|
||||
|
@ -192,18 +267,31 @@
|
|||
{
|
||||
L_CompanyName_Text = strWorkspaceName;
|
||||
}
|
||||
if (!String.IsNullOrEmpty(objWorkspaceInfo.EventLogUploadAddress))
|
||||
{
|
||||
strEventLogUploadAddress = objWorkspaceInfo.EventLogUploadAddress;
|
||||
}
|
||||
}
|
||||
strRDPCertificates = PageContentsHelper.GetRdpSigningCertificateHash();
|
||||
strClaimsHint = PageContentsHelper.GetClaimsHint();
|
||||
strRDPCertificates = RdwaConfig.GetRdpSigningCertificateHash();
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
|
@ -218,14 +306,33 @@
|
|||
{
|
||||
bFailedLogon = false;
|
||||
}
|
||||
|
||||
if (bFailedAuthorizationOverride)
|
||||
{
|
||||
bFailedLogon = false;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -233,12 +340,11 @@
|
|||
|
||||
if (!String.IsNullOrEmpty(strRedirectUrl))
|
||||
{
|
||||
Uri baseUrl = PageContentsHelper.GetBaseUri(Context);
|
||||
Uri redirectUri = new Uri(new Uri(baseUrl, Request.FilePath), strRedirectUrl + PageContentsHelper.AppendTenantIdToQuery(String.Empty));
|
||||
Uri redirectUri = new Uri(GetRealRequestUri(), strRedirectUrl);
|
||||
|
||||
if (
|
||||
redirectUri.Authority.Equals(baseUrl.Authority) &&
|
||||
redirectUri.Scheme.Equals(baseUrl.Scheme)
|
||||
redirectUri.Authority.Equals(Request.Url.Authority) &&
|
||||
redirectUri.Scheme.Equals(Request.Url.Scheme)
|
||||
)
|
||||
{
|
||||
strRedirectSafeUrl = redirectUri.AbsoluteUri;
|
||||
|
@ -248,11 +354,26 @@
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
</script>
|
||||
<RDWAPage
|
||||
helpurl="<%=sHelpSourceServer%>"
|
||||
|
@ -278,35 +399,21 @@
|
|||
onunload="onPageUnload(event)"/>
|
||||
<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="RDPCertificates" value="<%=SecurityElement.Escape(strRDPCertificates)%>"/>
|
||||
<input type="hidden" name="PublicModeTimeout" value="<%=SecurityElement.Escape(strPublicModeTimeout)%>"/>
|
||||
<input type="hidden" name="PrivateModeTimeout" value="<%=SecurityElement.Escape(strPrivateModeTimeout)%>"/>
|
||||
<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="ClaimsHint" value="<%=SecurityElement.Escape(strClaimsHint)%>"/>
|
||||
<input type="hidden" name="ClaimsToken" value=""/>
|
||||
|
||||
|
||||
<input name="isUtf8" type="hidden" value="1"/>
|
||||
<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"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="wrng"><%=L_WrongAxVersionWarningLabel_Text%></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="50"> </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>
|
||||
<td height="20"> </td>
|
||||
|
@ -316,8 +423,7 @@
|
|||
<td>
|
||||
<table width="300" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td id="tdDomainUserNameLabel" width="130" align="right" style="display:none"><%=L_DomainUserNameLabel_Text%></td>
|
||||
<td id="tdClaimsDomainUserNameLable" width="130" align="right" style="display:none"><%=L_ClaimsDomainUserNameLabel_Text%></td>
|
||||
<td width="130" align="right"><%=L_DomainUserNameLabel_Text%></td>
|
||||
<td width="7"></td>
|
||||
<td align="right">
|
||||
<label><input id="DomainUserName" name="DomainUserName" type="text" class="textInputField" runat="server" size="25" autocomplete="off" /></label>
|
||||
|
@ -344,6 +450,42 @@
|
|||
</td>
|
||||
</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\"";
|
||||
if ( bPasswordExpiredNoChange == true)
|
||||
|
@ -424,6 +566,46 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
strErrorMessageRowStyle = "style=\"display:none\"";
|
||||
if ( bFailedSMSLogon == true )
|
||||
{
|
||||
strErrorMessageRowStyle = "style=\"display:\"";
|
||||
}
|
||||
%>
|
||||
<tr id="tr1" <%=strErrorMessageRowStyle%> >
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td height="20"> </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"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="wrng"><%=L_LogonRadiusFailureLabel_Text%></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%
|
||||
strErrorMessageRowStyle = "style=\"display:none\"";
|
||||
if ( bFailedLogon == true )
|
||||
|
@ -457,9 +639,11 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<%
|
||||
strErrorMessageRowStyle = "style=\"display:none\"";
|
||||
if ( bFailedAuthorization || bFailedAuthorizationOverride )
|
||||
if ( bFailedAuthorization )
|
||||
{
|
||||
strErrorMessageRowStyle = "style=\"display:\"";
|
||||
}
|
||||
|
@ -497,19 +681,6 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="trErrorGenericClaimsAuthFailure" style="display:none" >
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td height="20"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="wrng"><%=L_GenericClaimsAuthErrorLabel_Text%></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td height="20"> </td>
|
||||
</tr>
|
||||
|
@ -543,8 +714,8 @@
|
|||
<td><%=L_PublicLabel_Text%></td>
|
||||
</tr>
|
||||
<tr id="trPubExp" style="display:none" >
|
||||
<td width="30"></td>
|
||||
<td><span class="expl"><%=L_PublicExplanationLabel_Text%></span></td>
|
||||
<td width="30"></td>
|
||||
<td><span class="expl"><%=L_PublicExplanationLabel_Text%></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="7"></td>
|
||||
|
@ -563,8 +734,8 @@
|
|||
<td><%=L_PrivateLabel_Text%></td>
|
||||
</tr>
|
||||
<tr id="trPrvtExp" style="display:none" >
|
||||
<td width="30"></td>
|
||||
<td><span class="expl"><%=L_PrivateExplanationLabel_Text%></span></td>
|
||||
<td width="30"></td>
|
||||
<td><span class="expl"><%=L_PrivateExplanationLabel_Text%></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td height="7"></td>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
if ( HttpContext.Current.User.Identity.IsAuthenticated == true )
|
||||
{
|
||||
Response.Redirect( "default.aspx" + AppendTenantIdToQuery(String.Empty) );
|
||||
Response.Redirect( "default.aspx" );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -32,34 +32,19 @@
|
|||
else if ( objQueryString["Error"].Equals("WkSDisconnected", StringComparison.CurrentCultureIgnoreCase) )
|
||||
{
|
||||
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>
|
||||
|
|
Binary file not shown.
BIN
RDSFactorWeb/RDWeb/Pages/en-US/smstoken.aspx
Normal file
BIN
RDSFactorWeb/RDWeb/Pages/en-US/smstoken.aspx
Normal file
Binary file not shown.
33
RDSFactorWeb/RDWeb/Pages/en-US/token.aspx
Normal file
33
RDSFactorWeb/RDWeb/Pages/en-US/token.aspx
Normal 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>
|
70
RDSFactorWeb/RDWeb/Pages/en-US/token.aspx.cs
Normal file
70
RDSFactorWeb/RDWeb/Pages/en-US/token.aspx.cs
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue