I have a pre-existing external WCF service that was written in .NET 4.8. The service requires using WS2007FederationHttp
, UserNameAuth
, TransportWith
using a SAMLV2.0 token and bearer key type.
My application is written for .NET 9, and I am using the System.ServiceModel
NuGet packages as the generated client code requires a System.ServiceModel.Binding
.
Does anyone have a way of achieving this?
This is what I have so far. The line commented out (and the username comment) are the bits that are unknown.
System.ServiceModel.WS2007HttpBinding w2007HttpBinding = new System.ServiceModel.WS2007HttpBinding(System.ServiceModel.SecurityMode.TransportWithMessageCredential);
w2007HttpBinding.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Basic; // Should be UserName
// System.ServiceModel.Federation.WSFederationHttpBinding binding = new System.ServiceModel.Federation.WSFederationHttpBinding( /*TransportWithMessageCredential */);
binding.Security.Message.IssuedKeyType = SecurityKeyType.BearerKey;
binding.Security.Message.NegotiateServiceCredential = true;
binding.Security.Message.EstablishSecurityContext = false;
binding.Security.Message.IssuerAddress = /* https:..... address of separate token service */
binding.Security.Message.IssuerBinding = w2007HttpBinding;
Note: I've tried using CoreWCF, but I could not find a way to convert the binding to System.ServiceModel.Binding
.