Great news for everyone who has still some WCF services running. Until recently only BasicHttpBinding and NetTcpBinding were supported. This limited the usefulness as most WCF services I encountered where using WSFederationHttpBinding (or the more recent WS2007FederationHttpBinding). These bindings were typically used in scenarios where users authenticate with a security token service (like Active Directory Federation Services).
Last month, the System.ServiceModel.Federation package was released, adding client(!) support for WSFederation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var issuerBinding = new WS2007HttpBinding(SecurityMode.TransportWithMessageCredential); | |
issuerBinding.Security.Message.ClientCredentialType = MessageCredentialType.UserName; | |
issuerBinding.Security.Message.EstablishSecurityContext = false; | |
var endpointAddress = new EndpointAddress("https://issueraddress/adfs/services/trust/13/usernamemixed"); | |
var tokenParameters = WSTrustTokenParameters.CreateWS2007FederationTokenParameters(issuerBinding, endpointAddress); | |
var binding = new WSFederationHttpBinding(tokenParameters); |
Remark: You cannot use this binding yet through dotnet-svcutil or the Visual Studioās WCF Web Service Reference Provider Tool but this will be added in the future.