using Longbow.Configuration;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Web;
namespace Bootstrap.Client.Controllers
{
///
/// Account controller.
///
[AllowAnonymous]
public class AccountController : Controller
{
///
///
///
///
public ActionResult Login()
{
var originUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].FirstOrDefault();
if (!string.IsNullOrEmpty(originUrl)) originUrl = $"?{CookieAuthenticationDefaults.ReturnUrlParameter}={HttpUtility.UrlEncode(originUrl)}";
return Redirect($"{ConfigurationManager.AppSettings["AuthHost"]}{CookieAuthenticationDefaults.LoginPath}{originUrl}");
}
///
/// Logout this instance.
///
/// The logout.
public IActionResult Logout()
{
return Redirect($"{ConfigurationManager.AppSettings["AuthHost"]}{CookieAuthenticationDefaults.LogoutPath}");
}
///
/// Accesses the denied.
///
/// The denied.
[ResponseCache(Duration = 600)]
public ActionResult AccessDenied()
{
return View();
}
}
}