Re: Authenticate to a webservice by WindowsIdentity
From: William Stacey [MVP] (staceywREMOVE_at_mvps.org)
Date: 01/28/05
- Next message: techieTex: "Re: SOAP Extensions"
- Previous message: Dilip Krishnan: "Re: Problem with Apache Axis sever and .NET Framework client"
- In reply to: Ray_at_Alirezaei.com: "Re: Authenticate to a webservice by WindowsIdentity"
- Next in thread: ALI-R: "Re: Authenticate to a webservice by WindowsIdentity"
- Reply: ALI-R: "Re: Authenticate to a webservice by WindowsIdentity"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 28 Jan 2005 09:50:17 -0500
Why not use WSE which has rich support for security tokens such as
UsernameTokens and SecurityContextTokens?
-- William Stacey, MVP http://mvp.support.microsoft.com <Ray@Alirezaei.com> wrote in message news:uvDzWyOBFHA.2104@TK2MSFTNGP14.phx.gbl... > I'd like to feed the output of this method which is of WindowsIdentity Type > to Webservice in a way.I just wondered if the following statements do the > same thing. > >>>>>> 1) rService.Credentials = new > >>>>>> System.Net.NetworkCredential("username","password","domainName"); > >>>>>> 2)rService.Credentials = > >>>>>> System.Net.CredentialCache.DefaultCredentials; > > thanks, > ALI-R > > "Dilip Krishnan" <dkrishnan@NOSPAM.geniant.com> wrote in message > news:229175632424486603471104@msnews.microsoft.com... > > Hello ALI-R, > > > > Not sure I follow what you're trying to achieve... where do you hope to > > call the Createidentity method? > > HTH > > Regards, > > Dilip Krishnan > > MCAD, MCSD.net > > dkrishnan at geniant dot com > > http://www.geniant.com > > > >> Thanks ,I think I somehow underestood it.Correct me if I'm wrong > >> please? Since we have enabled windows integrated authentication in our > >> web service which is serverd by IIS ,using > >> > >>>>>> 1) rService.Credentials = new > >>>>>> System.Net.NetworkCredential("username","password","domainName"); > >>>>>> 2)rService.Credentials = > >>>>>> System.Net.CredentialCache.DefaultCredentials; > >>>>>> > >> Infact we are using **WindowsIdentity** to authenticate to our > >> webservice,right? > >> > >> What I was looking for is to authenticate to the webservice in > >> something like where "LogonUser" is an API which I can use in > >> conjunction with the WindowsIdentity class to create a new temporary > >> identity to impersonate with later : > >> > >> public static WindowsIdentity CreateIdentity(string User, string > >> Domain, > >> string Password) > >> { > >> // The Windows NT user token. > >> IntPtr tokenHandle = new IntPtr(0); > >> const int LOGON32_PROVIDER_DEFAULT = 0; > >> const int LOGON32_LOGON_NETWORK_CLEARTEXT = 3; > >> tokenHandle = IntPtr.Zero; > >> > >> // Call LogonUser to obtain a handle to an access token. > >> bool returnValue = LogonUser(User, Domain, Password, > >> LOGON32_LOGON_NETWORK_CLEARTEXT, > >> LOGON32_PROVIDER_DEFAULT, > >> ref tokenHandle); > >> if (false == returnValue) > >> { > >> int ret = Marshal.GetLastWin32Error(); > >> throw new Exception("LogonUser failed with error code: > >> " + > >> ret); > >> } > >> //The WindowsIdentity class makes a new copy of the token. > >> //It also handles calling CloseHandle for the copy. > >> WindowsIdentity id = new WindowsIdentity(tokenHandle); > >> CloseHandle(tokenHandle); > >> return id; > >> } > >> Thanks again, > >> Ali-R > >> "Dilip Krishnan" <dkrishnan@NOSPAM.geniant.com> wrote in message > >> news:227216632424123641457360@msnews.microsoft.com... > >> > >>> Hello ALI-R, > >>> ws = web service. In your case web page as such is protected by IIS > >>> (read > >>> transport level). WS-Security gives you message level > >> authentication/integrity/confidentiality > >> > >>> (has nothing to do with IIS or http). When you set the credentials > >>> you are actually using windows/basic authentication supported by IIS. > >>> > >>> HTH > >>> Regards, > >>> Dilip Krishnan > >>> MCAD, MCSD.net > >>> dkrishnan at geniant dot com > >>> http://www.geniant.com > >>>> what do you mean by they don't use windows security? > >>>> > >>>> Thanks > >>>> "Dilip Krishnan" <dkrishnan@NOSPAM.geniant.com> wrote in message > >>>> news:222455632423579221519936@msnews.microsoft.com... > >>>>> Hello ALI-R, > >>>>> Both the methods you suggested use windows identity to > >>>>> authenticate! > >>>> Only > >>>> > >>>>> they dont use ws security. They use IIS authentication. > >>>>> > >>>>> HTH > >>>>> Regards, > >>>>> Dilip Krishnan > >>>>> MCAD, MCSD.net > >>>>> dkrishnan at geniant dot com > >>>>> http://www.geniant.com > >>>>>> I know how to authenticate to a webservice using either of these > >>>>>> ways(Assuming that rService represents the webservice): > >>>>>> > >>>>>> 1) rService.Credentials = new > >>>>>> System.Net.NetworkCredential("username","password","domainName"); > >>>>>> 2)rService.Credentials = > >>>>>> System.Net.CredentialCache.DefaultCredentials; > >>>>>> > >>>>>> My question is that is there a way to authenticate to a user using > >>>>>> WindowsIdentity ??? > >>>>>> > >>>>>> Thanks for your help > >>>>>> > > > > > >
- Next message: techieTex: "Re: SOAP Extensions"
- Previous message: Dilip Krishnan: "Re: Problem with Apache Axis sever and .NET Framework client"
- In reply to: Ray_at_Alirezaei.com: "Re: Authenticate to a webservice by WindowsIdentity"
- Next in thread: ALI-R: "Re: Authenticate to a webservice by WindowsIdentity"
- Reply: ALI-R: "Re: Authenticate to a webservice by WindowsIdentity"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|