Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ publish

# NuGet Packages Directory
packages
.nuget/nuget.exe

# Windows Azure Build Output
csx
Expand Down
28 changes: 16 additions & 12 deletions DataDictionary/Helpers/CasMvc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,26 @@ public static ActionResult Login()
if (!string.IsNullOrEmpty(ticket))
{
// validate ticket against cas
var sr = new StreamReader(new WebClient().OpenRead(StrCasUrl + "validate?ticket=" + ticket + "&service=" + service));

// parse text file
if (sr.ReadLine() == "yes")
// Ensure TLS 1.2 is used for the HTTPS connection to the CAS server
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
using (var webClient = new WebClient())
using (var sr = new StreamReader(webClient.OpenRead(StrCasUrl + "validate?ticket=" + ticket + "&service=" + service)))
{
// get kerberos id
string kerberos = sr.ReadLine();
// parse text file
if (sr.ReadLine() == "yes")
{
// get kerberos id
string kerberos = sr.ReadLine();

// set forms authentication ticket
FormsAuthentication.SetAuthCookie(kerberos, false);
// set forms authentication ticket
FormsAuthentication.SetAuthCookie(kerberos, false);

string returnUrl = GetReturnUrl();
string returnUrl = GetReturnUrl();

return !string.IsNullOrEmpty(returnUrl)
? new RedirectResult(returnUrl)
: new RedirectResult(FormsAuthentication.DefaultUrl);
return !string.IsNullOrEmpty(returnUrl)
? new RedirectResult(returnUrl)
: new RedirectResult(FormsAuthentication.DefaultUrl);
}
}
}

Expand Down