mirror of
https://github.com/jakobadam/RDSFactor.git
synced 2025-08-20 22:44:20 +02:00
Propagate error message from RADIUS server to RD Web
Through the RADIUS Reply-Message attribute.
This commit is contained in:
parent
258b3f5663
commit
66902b2f34
3 changed files with 54 additions and 14 deletions
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml-stylesheet type="text/xsl" href="../Site.xsl"?>
|
||||
<?xml-stylesheet type="text/css" href="../RenderFail.css"?>
|
||||
<% @Page Language="C#" Debug="false" ResponseEncoding="utf-8" ContentType="text/xml" %>
|
||||
|
||||
<% @Page Language="C#" Debug="true" ResponseEncoding="utf-8" ContentType="text/xml" %>
|
||||
<% @Import Namespace="System " %>
|
||||
<% @Import Namespace="System.Security" %>
|
||||
<% @Import Namespace="Microsoft.TerminalServices.Publishing.Portal.FormAuthentication" %>
|
||||
|
@ -67,6 +68,7 @@
|
|||
public bool bSessionExpired = false;
|
||||
public string strPrivateModeTimeout = "240";
|
||||
public string strPublicModeTimeout = "20";
|
||||
public string message;
|
||||
|
||||
public WorkspaceInfo objWorkspaceInfo = null;
|
||||
|
||||
|
@ -103,6 +105,11 @@
|
|||
|
||||
void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (Session["Message"] != null) {
|
||||
message = (string)Session["Message"];
|
||||
Session["Message"] = null;
|
||||
}
|
||||
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
Session["UserPass"] = "";
|
||||
|
@ -343,7 +350,7 @@
|
|||
onload="onLoginPageLoad(event)"
|
||||
onunload="onPageUnload(event)"/>
|
||||
<HTMLMainContent>
|
||||
|
||||
|
||||
<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)%>"/>
|
||||
|
@ -430,6 +437,20 @@
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<% if (message != null){ %>
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td height="20"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span class="wrng"><%=message%></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
|
||||
<%
|
||||
strErrorMessageRowStyle = "style=\"display:none\"";
|
||||
|
|
|
@ -60,19 +60,29 @@ public partial class SMSToken : System.Web.UI.Page
|
|||
onRadiusAccept(response);
|
||||
}
|
||||
else {
|
||||
Session["UserPass"] = "";
|
||||
Session["DomainUserName"] = "";
|
||||
SafeRedirect("logoff.aspx?Error=LoginSMSFailed");
|
||||
onRadiusReject(response);
|
||||
}
|
||||
}
|
||||
|
||||
void onRadiusReject(RADIUSPacket response) {
|
||||
if (response.Attributes.AttributeExists(RadiusAttributeType.ReplyMessage)){
|
||||
// Why on earth did the RD Web developer(s) use a thousand different URL parameters to logoff to indicate the error
|
||||
// message, when they could just put the message in the session
|
||||
String message = response.Attributes.GetFirstAttribute(RadiusAttributeType.ReplyMessage).ToString();
|
||||
Session["Message"] = message;
|
||||
}
|
||||
Session["UserPass"] = "";
|
||||
Session["DomainUserName"] = "";
|
||||
SafeRedirect("logoff.aspx");
|
||||
}
|
||||
|
||||
void onRadiusChallange(RADIUSPacket response){
|
||||
RADIUSAttribute state = response.Attributes.GetFirstAttribute(RadiusAttributeType.State);
|
||||
Session["State"] = state;
|
||||
}
|
||||
|
||||
void onRadiusAccept(RADIUSPacket response){
|
||||
string sessionGuid = response.Attributes.GetFirstAttribute(RadiusAttributeType.ReplyMessage).GetString();
|
||||
string sessionGuid = response.Attributes.GetFirstAttribute(RadiusAttributeType.ReplyMessage).ToString();
|
||||
Session["SESSIONGUID"] = sessionGuid;
|
||||
|
||||
HttpCookie myCookie = new HttpCookie("RadiusSessionId");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue