Skip to content

Commit

Permalink
Fixes mixup
Browse files Browse the repository at this point in the history
  • Loading branch information
joseftw committed Jul 18, 2019
1 parent 5e96983 commit 5bd3d1b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected override async Task HandleChallengeAsync(AuthenticationProperties prop
{ {
Response.StatusCode = 401; Response.StatusCode = 401;
Response.ContentType = ProblemDetailsContentType; Response.ContentType = ProblemDetailsContentType;
var problemDetails = new UnauthenticatedProblemDetails(); var problemDetails = new UnauthorizedProblemDetails();


await Response.WriteAsync(JsonConvert.SerializeObject(problemDetails)); await Response.WriteAsync(JsonConvert.SerializeObject(problemDetails));
} }
Expand All @@ -79,7 +79,7 @@ protected override async Task HandleForbiddenAsync(AuthenticationProperties prop
{ {
Response.StatusCode = 403; Response.StatusCode = 403;
Response.ContentType = ProblemDetailsContentType; Response.ContentType = ProblemDetailsContentType;
var problemDetails = new UnauthorizedProblemDetails(); var problemDetails = new ForbiddenProblemDetails();


await Response.WriteAsync(JsonConvert.SerializeObject(problemDetails)); await Response.WriteAsync(JsonConvert.SerializeObject(problemDetails));
} }
Expand Down

This file was deleted.

Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;


namespace JOS.ApiKeyAuthentication.Web.Features.Authorization namespace JOS.ApiKeyAuthentication.Web.Features.Authentication
{ {
public class UnauthorizedProblemDetails : ProblemDetails public class UnauthorizedProblemDetails : ProblemDetails
{ {
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,15 @@
using Microsoft.AspNetCore.Mvc;

namespace JOS.ApiKeyAuthentication.Web.Features.Authorization
{
public class ForbiddenProblemDetails : ProblemDetails
{
public ForbiddenProblemDetails(string details = null)
{
Title = "Forbidden";
Detail = details;
Status = 403;
Type = "https://httpstatuses.com/403";
}
}
}

0 comments on commit 5bd3d1b

Please sign in to comment.