mirror of
https://github.com/jakobadam/RDSFactor.git
synced 2025-06-12 07:24:30 +02:00
Use radar instead of RadiusClient
This commit is contained in:
parent
b90799184b
commit
01c78645ad
6 changed files with 24 additions and 50 deletions
Binary file not shown.
Binary file not shown.
|
@ -6,7 +6,7 @@
|
|||
<% @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>
|
||||
|
||||
//
|
||||
|
|
Binary file not shown.
|
@ -3,31 +3,22 @@
|
|||
<!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() {
|
||||
|
||||
}
|
||||
<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>
|
||||
}
|
||||
</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>
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using RadiusClient;
|
||||
using RADAR;
|
||||
using System.Configuration;
|
||||
|
||||
|
||||
|
@ -13,54 +13,37 @@ public partial class Pages_en_US_token : System.Web.UI.Page
|
|||
{
|
||||
string tmpUser = Request.QueryString["User"];
|
||||
string DomainUserName = tmpUser.Replace("UserName:s:", "");
|
||||
// Label1.Text = DomainUserName;
|
||||
HttpCookie myCookie = new HttpCookie("RadiusSessionId");
|
||||
myCookie = Request.Cookies["RadiusSessionId"];
|
||||
HttpCookie sessionId = new HttpCookie("RadiusSessionId");
|
||||
sessionId = Request.Cookies["RadiusSessionId"];
|
||||
|
||||
// Read the cookie information and display it.
|
||||
if (myCookie != null)
|
||||
if (sessionId != null)
|
||||
{
|
||||
|
||||
string RadiusServer = ConfigurationManager.AppSettings["RadiusServer"];
|
||||
string RadiusSecret = ConfigurationManager.AppSettings["RadiusSecret"];
|
||||
Radius_Client myRadius = new Radius_Client(RadiusServer, 1812);
|
||||
|
||||
RADIUSPacket rp = default(RADIUSPacket);
|
||||
|
||||
RADIUSClient client = new RADIUSClient(RadiusServer, 1812, RadiusSecret);
|
||||
|
||||
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)
|
||||
RADIUSPacket response = client.Authenticate(DomainUserName, sessionId.Value, atts);
|
||||
if (response.Code == RadiusPacketCode.AccessAccept)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue