Mixed authentication modes: send both Kerberos token and username token over HTTPs with WCF
Is it possible to send both username t开发者_开发百科oken and the kerberos token over HTTPs with WCF?
We are able to use custom binding with authentication mode set to 'UserNameOverTransport', which will include a username token in the SOAP header as per OASIS web services security standard.
Alternatively can set the authentication mode to 'KerberosOverTransport', which will include a Kerberos token in the SOAP header.
However the service we are trying to communicate has a requirement to authenticate use both kerberos token & username token. It doesn't seem to be possible with the existing authentication modes.
The token (which is a Kerberos token) actually has the username embedded in it. So if you need to communicate with a service that requires both then you'll want to use KerberosOverTransport
.
You'll then want to pass the token to the constructor of WindowsIdentity which asks for an IntPtr.
Once you have it constructed you can access the username via the name property. A piece of code that is almost what you need (sans the logging in bits) can be found here:
http://kseesharp.blogspot.com/2009/04/c-create-windowsidentity-from-userid.html
精彩评论