Extract NetworkCredential from WindowsIdentity

W

Web Developer

I'm using the Windows Integrated Authentication scheme for my web apps and
web services. When my web applications make calls to the web services I need
to attach the NetworkCredential of the requesting user to the web service
proxy client.

I can achieve this by impersonating the requesting user, and setting the web
service proxy's Credentials member as follows:
SoapHttpClientProtocol.Credentials =
System.Net.CredentialCache.DefaultCredentials

However, I don't always want to impersonate the requesting user since I have
to grant them access to systems folders like "Temporary ASP.NET Files" etc.

It seems like I should be able to create a NetworkCredential from the
WindowsIdentity, but the WindowsIdentity only exposes a "Name" member - no
password.

Another option is to manually impersonate the user, set the Credentials
member of the proxy client, and then revert back, but this seems pretty
kludgy.

Does anyone know how to derive a NetworkCredential from a WindowsIdentity?

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top