How to Pass Authorization Credentials/Header From Dotnet API to Nginx Reverse Proxy?

Viewed 25

I recently posted a question

.NET Web API, Vue 3, NGINX - Reverse Proxy Doesn't Seem to be Working and Getting CORS 401 Unauthorized Issue - Where am I going wrong?

and since, I have learned that the main issue I am facing was an error 401 Unauthorized.

I am hosting a Vue 3 app on Nginx at 127.0.0.1 and my .Net 6 API on Kestrel at https://127.0.0.5001

I am using Negotiate in my API to get the username of the user currently accessing the site, using User.Identity.Name

What I want to know is, how do I pass the required authentication information or headers from my API, through to my app? What information do I need in Program.cs to achieve this, and what do I need in my Nginx config file to allow this to work?

I found this page regarding SPNs, it is the only thing I have not yet been able to try as I am on a work domain and don't think i'll have the required privileges to do so - Is this what is preventing it all from working?

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/windowsauth?view=aspnetcore-6.0&tabs=visual-studio#windows-environment-configuration

Alternatively, if I am not able to use Negotiate to pass through the current logged on username, is there another way of achieving this?

0 Answers
Related