My backend is an ASPNet WebApi2 running under IIS and uses Windows Authentification
.
I have 2 clients:
WinForms: Passing the credentials is simple. I do the following:
var credentialCache = new CredentialCache(); credentialCache.Add(new Uri(uri.GetLeftPart(UriPartial.Authority)), "NTLM", credentials); WebRequestHandler handler = new WebRequestHandler() { AuthenticationLevel = AuthenticationLevel.MutualAuthRequested, Credentials = credentialCache, PreAuthenticate = true, UseDefaultCredentials = false }; client = new HttpClient(handler, true) { BaseAddress = uri, };
Angular: As the end-user will access the WebApi backend using the Angular app from non-Windows systems, how can I pass his/her windows credentials? (I have a login screen where the user must enter his domain/name and password).
I would like to pass the user credentials through code. Something like typed_rest-client. Unfortunately this lib is causing build errors and cannot be used.