I have a web application that wants to do authentication on every http request. I am trying to build a custom middle ware to do this
here is what I am looking to do
1. a user makes a request to an end point in my application http://localhost:5000/api/get-------> 302 Response
I generate a redirect to do authorization http://{domain}/authorize ----------> 200 response if successful
I return 200 with results if authorization is success or 401 if not http://localhost:5000/api/get-------> 200 or 401 response
in my middles ware I am calling httpContext.Response.Redirect("http://{domain}/authorize", false);
which generates the redirect, but how can I go from there?
How can I capture the new httpContext which in that case the authorize call and how can I go back to the original context to return 200 after success?