最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - .NET 9 Creating a WS2007FederationBinding with ServiceModel - Stack Overflow

programmeradmin4浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论