Browse Source

Added some logging when app returns 404.

pull/636/head
Sebastian 5 years ago
parent
commit
3bfe5fd00e
  1. 16
      backend/src/Squidex.Web/Pipeline/AppResolver.cs

16
backend/src/Squidex.Web/Pipeline/AppResolver.cs

@ -13,10 +13,12 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using Squidex.Domain.Apps.Entities; using Squidex.Domain.Apps.Entities;
using Squidex.Domain.Apps.Entities.Apps; using Squidex.Domain.Apps.Entities.Apps;
using Squidex.Infrastructure; using Squidex.Infrastructure;
using Squidex.Infrastructure.Security; using Squidex.Infrastructure.Security;
using Squidex.Log;
using Squidex.Shared; using Squidex.Shared;
using Squidex.Shared.Identity; using Squidex.Shared.Identity;
@ -47,6 +49,13 @@ namespace Squidex.Web.Pipeline
if (app == null) if (app == null)
{ {
var log = context.HttpContext.RequestServices?.GetService<ISemanticLog>();
log?.LogWarning(w => w
.WriteProperty("message", "Cannot find app with the given name.")
.WriteProperty("appId", "404")
.WriteProperty("appName", appName));
context.Result = new NotFoundResult(); context.Result = new NotFoundResult();
return; return;
} }
@ -88,6 +97,13 @@ namespace Squidex.Web.Pipeline
} }
else else
{ {
var log = context.HttpContext.RequestServices?.GetService<ISemanticLog>();
log?.LogWarning(w => w
.WriteProperty("message", "Authenticated user has no permission to access the app.")
.WriteProperty("appId", app.Id.ToString())
.WriteProperty("appName", appName));
context.Result = new NotFoundResult(); context.Result = new NotFoundResult();
} }

Loading…
Cancel
Save