2013-04-12 5 views
1

WsFederationHttpBinding 끝 점을 프로그래밍 방식으로 노출하는 WCF 서비스가 있습니다. 그런 다음 Visual Studio를 사용하여 서비스 참조 대화 상자를 사용하여 클라이언트 측 끝점을 만들고 싶습니다. 클라이언트가 올바른 끝점과 바인딩을 생성하지만 STS에 대한 클라이언트 구성에서 바인딩을 수동으로 만들어 연합 된 서비스 바인딩의 발급자 요소에 연결해야합니다. STS 바인딩이 클라이언트에서 자동으로 생성되도록 서버 측 바인딩을 만드는 방법이 있습니까? 내가 코드에서 바인딩을 생성하는 방법이 기본적으로MEX를 통해 WsFederationHttpBinding 끝점에 대한 STS 바인딩을 자동으로 생성 할 수 있습니까?

:

public class MyServiceHost : ServiceHostFactory 
{ 
    protected override void AddServiceEndpoint(ServiceHost host, Type contract, Uri address) 
    { 
     var binding = new WSFederationHttpBinding(); 
     // set up some binding properties here 
     binding.Security = new WSFederationHttpSecurity 
     { 
      Mode = WSFederationHttpSecurityMode.Message, 
      Message = new FederatedMessageSecurityOverHttp 
      { 
       AlgorithmSuite = SecurityAlgorithmSuite.Default, 
       EstablishSecurityContext = true, 
       IssuedTokenType = "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1", 
       NegotiateServiceCredential = false, 
       IssuerAddress = new EndpointAddress(
        new Uri("http://mydomain/STSService.svc"), 
        EndpointIdentity.CreateSpnIdentity("http/IDENTITYMASKED")), 
       IssuerBinding = new WSHttpBinding 
       { 
        Name = "stsBinding", 
        Security = new WSHttpSecurity 
        { 
         Mode = SecurityMode.Message, 
         Message = new NonDualMessageSecurityOverHttp 
         { 
          ClientCredentialType = MessageCredentialType.Windows, 
          NegotiateServiceCredential = true, 
          AlgorithmSuite = SecurityAlgorithmSuite.Default, 
          EstablishSecurityContext = false 
         } 
        } 
       } 
      } 
     }; 
     host.AddServiceEndpoint(contract, binding, address); 
    } 
} 

나는 Visual Studio에서 구성 거기 stsBinding 밤은을이에 대한 프록시를 생성되거나 엮은 경우에이 얻을 수있는 방법이 있나요 MEX가 그것을 허용하지 않습니까?

+0

서비스 측면에서 프로그래밍 방식으로 바인딩에 어려움을 겪고 있습니다. 게시 할 수 있습니까? 정말 멋질거야! – nvoigt

+0

괜찮아요 질문 업데이트 : –

답변

0

내 서비스가 아직 실행되지 않아서 (아직 테스트되지 않은) 내 코드가 FederatedMessageSecurityOverHttp 요소의 IssuerMetadataAddress를 설정했기 때문에 도움이되는지 확신 할 수 없습니다. 클라이언트 마법사가 해당 바인딩을 생성 할 수 있어야합니다.

+0

그것은 날 위해 일을 못해서, STS는 실제로 몇 가지 사용자 정의 바인딩을 노출합니다 :(나는 아마도 그 창문을 사용하고 싶어하지 않는 것을 의미하는 토큰을 얻으려고하면 두려운 cardspace 예외가 발생합니다 신임장... –