Skip to content

Commit

Permalink
Remove: IP info in log
Browse files Browse the repository at this point in the history
nginx hide them
  • Loading branch information
DCTewi committed Jun 23, 2021
1 parent 7ac2d7f commit aabb94a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public Task Invoke(HttpContext httpContext,
if (path.StartsWith("/_blazor") || path.EndsWith(".css") || path.EndsWith(".js"))
{
logger.LogTrace(
$"IP[{httpContext.Connection.RemoteIpAddress?.ToString()}] try to access [{path}]");
$"User[{httpContext?.User?.Identity?.Name ?? "<Unknown>"}] try to access [{path}]");
}
else
{
logger.LogInformation(
$"IP[{httpContext.Connection.RemoteIpAddress?.ToString()}] try to access [{path}]");
$"User[{httpContext?.User?.Identity?.Name ?? "<Unknown>"}] try to access [{path}]");

var isSigned = signInManager.IsSignedIn(httpContext.User);

Expand All @@ -52,7 +52,7 @@ public Task Invoke(HttpContext httpContext,
if (!options.Whitelist.Contains(path))
{
logger.LogInformation(
$"IP[{httpContext.Connection.RemoteIpAddress?.ToString()}] User[{httpContext?.User?.Identity?.Name}] access denied for [{path}]");
$"User[{httpContext?.User?.Identity?.Name ?? "<Unknown>"}] access denied for [{path}]");

httpContext.Response.Redirect(options.AuthPath);

Expand Down
2 changes: 1 addition & 1 deletion VirtualGroupEx.Server/Middlewares/PostLoginMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ await signInManager.PasswordSignInAsync(
if (httpContext.Request.Path == options.LogOutPath)
{
logger.LogInformation(
$"IP[{httpContext.Request.Host.Value}] User [{httpContext.User.Identity.Name}] logged out");
$"User [{httpContext.User.Identity.Name}] logged out");

await signInManager.SignOutAsync();
httpContext.Response.Redirect("/");
Expand Down

0 comments on commit aabb94a

Please sign in to comment.