Skip to content

Instantly share code, notes, and snippets.

@srkirkland
Created August 28, 2012 22:15
Show Gist options
  • Save srkirkland/3504832 to your computer and use it in GitHub Desktop.
Save srkirkland/3504832 to your computer and use it in GitHub Desktop.
general CAS authentication AccountController with UCDArch
using System.Web.Mvc;
using System.Web.Security;
using System.Web.Services.Description;
using Purchasing.Core.Domain;
using UCDArch.Web.Authentication;
namespace Sample.Web.Controllers
{
/// <summary>
/// Controller for the Account class
/// </summary>
public class AccountController : Controller
{
public ActionResult LogOn(string returnUrl)
{
string resultUrl = CASHelper.Login(); //Do the CAS Login
if (resultUrl != null)
{
return Redirect(resultUrl);
}
TempData["URL"] = returnUrl;
return View(); //Return the "not authorized" view
}
public ActionResult LogOut()
{
FormsAuthentication.SignOut();
return Redirect("https://cas.ucdavis.edu/cas/logout");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment