Created
August 28, 2012 22:15
-
-
Save srkirkland/3504832 to your computer and use it in GitHub Desktop.
general CAS authentication AccountController with UCDArch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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