OpenAuth.Net/OpenAuth.WebTest/Controllers/HomeController.cs

28 lines
675 B
C#
Raw Normal View History

2016-07-08 19:43:35 +08:00
using System.Configuration;
using System.Web.Mvc;
2016-07-08 18:51:48 +08:00
using OpenAuth.App;
2016-07-08 11:28:38 +08:00
using OpenAuth.App.SSO;
namespace OpenAuth.WebTest.Controllers
{
public class HomeController :Controller
{
2016-07-08 18:51:48 +08:00
2016-07-08 11:28:38 +08:00
[SSOAuth]
public ActionResult Index()
{
2016-07-08 18:51:48 +08:00
var currentUser = AuthUtil.GetCurrentUser();
ViewBag.CurrentUser = currentUser;
2016-07-08 11:28:38 +08:00
return View();
}
2016-07-08 18:51:48 +08:00
2016-07-11 18:21:26 +08:00
/// <summary>
/// 跳转到后台管理页面
/// </summary>
2016-07-08 18:51:48 +08:00
public ActionResult Admin()
{
2016-07-08 19:43:35 +08:00
return Redirect(ConfigurationManager.AppSettings["OpenAuthURL"] + "?token=" + Request.Cookies["Token"].Value);
2016-07-08 18:51:48 +08:00
}
2016-07-08 11:28:38 +08:00
}
}