protected override async Task HandleForbiddenAsync(AuthenticationProperties properties) { Response.StatusCode = 403; Response.ContentType = ProblemDetailsContentType; var problemDetails = new ForbiddenProblemDetails(); await Response.WriteAsync(JsonSerializer.Serialize(problemDetails, DefaultJsonSerializerOptions.Options)); }
protected override async Task HandleForbiddenAsync(AuthenticationProperties properties) { if (properties.Items.ContainsKey("##APIKEY")) { Response.StatusCode = 403; Response.ContentType = ProblemDetailsContentType; var problemDetails = new ForbiddenProblemDetails(); await Response.WriteAsync(JsonSerializer.Serialize(problemDetails, jsonSerializerOptions)); } }