mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 17:42:49 -05:00
Merge SSO and Portal projects
This commit is contained in:
43
bitwarden_license/src/Sso/Controllers/HomeController.cs
Normal file
43
bitwarden_license/src/Sso/Controllers/HomeController.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using IdentityServer4.Services;
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Sso.Models;
|
||||
|
||||
namespace Bit.Sso.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly IIdentityServerInteractionService _interaction;
|
||||
|
||||
public HomeController(IIdentityServerInteractionService interaction)
|
||||
{
|
||||
_interaction = interaction;
|
||||
}
|
||||
|
||||
[HttpGet("~/alive")]
|
||||
[HttpGet("~/now")]
|
||||
[AllowAnonymous]
|
||||
public DateTime GetAlive()
|
||||
{
|
||||
return DateTime.UtcNow;
|
||||
}
|
||||
|
||||
[HttpGet("~/Error")]
|
||||
[HttpGet("~/Home/Error")]
|
||||
public async Task<IActionResult> Error(string errorId)
|
||||
{
|
||||
var vm = new ErrorViewModel();
|
||||
|
||||
// retrieve error details from identityserver
|
||||
var message = await _interaction.GetErrorContextAsync(errorId);
|
||||
if (message != null)
|
||||
{
|
||||
vm.Error = message;
|
||||
}
|
||||
|
||||
return View("Error", vm);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user