Skip to content

Commit

Permalink
emit logs on response handling
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Sep 23, 2022
1 parent fdfefa8 commit b486b71
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Duende.Bff/EndpointProcessing/BffAuthenticationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public async Task ChallengeAsync(HttpContext context, string? scheme, Authentica
var requireResponseHandling = endpoint.Metadata.GetMetadata<IBffApiSkipResponseHandling>() == null;
if (requireResponseHandling)
{
_logger.LogDebug("Challenge was called for a BFF API endpoint, BFF response handing changing status code to 401.");

context.Response.StatusCode = 401;
context.Response.Headers.Remove("Location");
context.Response.Headers.Remove("Set-Cookie");
Expand All @@ -79,6 +81,8 @@ public async Task ForbidAsync(HttpContext context, string? scheme, Authenticatio
var requireResponseHandling = endpoint.Metadata.GetMetadata<IBffApiSkipResponseHandling>() == null;
if (requireResponseHandling)
{
_logger.LogDebug("Forbid was called for a BFF API endpoint, BFF response handing changing status code to 403.");

context.Response.StatusCode = 403;
context.Response.Headers.Remove("Location");
context.Response.Headers.Remove("Set-Cookie");
Expand Down

0 comments on commit b486b71

Please sign in to comment.