I think this question is kind of trivial, but I cannot find an answer to it:
I am using Ocelot as an API Gateway and use my own authentication middleware, since I need to authenticate the users against our own database. The happy path is working just fine. However, if the user cannot authenticate I can only return 500 internal server error, but I have not idea how to make ocelot return a 401.
Can anyone help me? This would be the very basic of what I mean:
var authSuccess = authenticate();
if (authSuccess)
{
await next.Invoke();
} else
{
// cancel and Return 401
}