mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 17:42:49 -05:00
Revert filescoped (#2227)
* Revert "Add git blame entry (#2226)" This reverts commit239286737d
. * Revert "Turn on file scoped namespaces (#2225)" This reverts commit34fb4cca2a
.
This commit is contained in:
@ -5,50 +5,51 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Diagnostics;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Bit.Sso.Controllers;
|
||||
|
||||
public class HomeController : Controller
|
||||
namespace Bit.Sso.Controllers
|
||||
{
|
||||
private readonly IIdentityServerInteractionService _interaction;
|
||||
|
||||
public HomeController(IIdentityServerInteractionService interaction)
|
||||
public class HomeController : Controller
|
||||
{
|
||||
_interaction = interaction;
|
||||
}
|
||||
private readonly IIdentityServerInteractionService _interaction;
|
||||
|
||||
[Route("~/Error")]
|
||||
[Route("~/Home/Error")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> Error(string errorId)
|
||||
{
|
||||
var vm = new ErrorViewModel();
|
||||
|
||||
// retrieve error details from identityserver
|
||||
var message = string.IsNullOrWhiteSpace(errorId) ? null :
|
||||
await _interaction.GetErrorContextAsync(errorId);
|
||||
if (message != null)
|
||||
public HomeController(IIdentityServerInteractionService interaction)
|
||||
{
|
||||
vm.Error = message;
|
||||
_interaction = interaction;
|
||||
}
|
||||
else
|
||||
|
||||
[Route("~/Error")]
|
||||
[Route("~/Home/Error")]
|
||||
[AllowAnonymous]
|
||||
public async Task<IActionResult> Error(string errorId)
|
||||
{
|
||||
vm.RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
var exceptionHandlerPathFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
|
||||
var exception = exceptionHandlerPathFeature?.Error;
|
||||
if (exception is InvalidOperationException opEx && opEx.Message.Contains("schemes are: "))
|
||||
var vm = new ErrorViewModel();
|
||||
|
||||
// retrieve error details from identityserver
|
||||
var message = string.IsNullOrWhiteSpace(errorId) ? null :
|
||||
await _interaction.GetErrorContextAsync(errorId);
|
||||
if (message != null)
|
||||
{
|
||||
// Messages coming from aspnetcore with a message
|
||||
// similar to "The registered sign-in schemes are: {schemes}."
|
||||
// will expose other Org IDs and sign-in schemes enabled on
|
||||
// the server. These errors should be truncated to just the
|
||||
// scheme impacted (always the first sentence)
|
||||
var cleanupPoint = opEx.Message.IndexOf(". ") + 1;
|
||||
var exMessage = opEx.Message.Substring(0, cleanupPoint);
|
||||
exception = new InvalidOperationException(exMessage, opEx);
|
||||
vm.Error = message;
|
||||
}
|
||||
else
|
||||
{
|
||||
vm.RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
|
||||
var exceptionHandlerPathFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
|
||||
var exception = exceptionHandlerPathFeature?.Error;
|
||||
if (exception is InvalidOperationException opEx && opEx.Message.Contains("schemes are: "))
|
||||
{
|
||||
// Messages coming from aspnetcore with a message
|
||||
// similar to "The registered sign-in schemes are: {schemes}."
|
||||
// will expose other Org IDs and sign-in schemes enabled on
|
||||
// the server. These errors should be truncated to just the
|
||||
// scheme impacted (always the first sentence)
|
||||
var cleanupPoint = opEx.Message.IndexOf(". ") + 1;
|
||||
var exMessage = opEx.Message.Substring(0, cleanupPoint);
|
||||
exception = new InvalidOperationException(exMessage, opEx);
|
||||
}
|
||||
vm.Exception = exception;
|
||||
}
|
||||
vm.Exception = exception;
|
||||
}
|
||||
|
||||
return View("Error", vm);
|
||||
return View("Error", vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user