refacto error handling
This commit is contained in:
parent
fda43ba2d1
commit
786016344b
8 changed files with 126 additions and 45 deletions
|
|
@ -16,6 +16,7 @@ using System.Collections.Generic;
|
|||
using System;
|
||||
using Yavsc;
|
||||
using Yavsc.Extensions;
|
||||
using Yavsc.Models;
|
||||
|
||||
namespace IdentityServerHost.Quickstart.UI
|
||||
{
|
||||
|
|
@ -53,10 +54,11 @@ namespace IdentityServerHost.Quickstart.UI
|
|||
{
|
||||
return View("Index", vm);
|
||||
}
|
||||
|
||||
return View("Error");
|
||||
return this.ErrorView<ConsentController>("No consent request matching request: " + returnUrl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handles the consent screen postback
|
||||
/// </summary>
|
||||
|
|
@ -88,8 +90,8 @@ namespace IdentityServerHost.Quickstart.UI
|
|||
{
|
||||
return View("Index", result.ViewModel);
|
||||
}
|
||||
|
||||
return View("Error");
|
||||
return this.ErrorView<ConsentController>($"ReturnUrl: {model}, result: {result}" );
|
||||
|
||||
}
|
||||
|
||||
/*****************************************/
|
||||
|
|
@ -170,11 +172,6 @@ namespace IdentityServerHost.Quickstart.UI
|
|||
{
|
||||
return CreateConsentViewModel(model, returnUrl, request);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError("No consent request matching request: {0}", returnUrl);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +196,7 @@ namespace IdentityServerHost.Quickstart.UI
|
|||
vm.IdentityScopes = request.ValidatedResources.Resources.IdentityResources.Select(x => CreateScopeViewModel(x, vm.ScopesConsented.Contains(x.Name) || model == null)).ToArray();
|
||||
|
||||
var apiScopes = new List<ScopeViewModel>();
|
||||
foreach(var parsedScope in request.ValidatedResources.ParsedScopes)
|
||||
foreach (var parsedScope in request.ValidatedResources.ParsedScopes)
|
||||
{
|
||||
var apiScope = request.ValidatedResources.Resources.FindApiScope(parsedScope.ParsedName);
|
||||
if (apiScope != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue