2012-02-28 3 views
0

ADFS에서 보안 토큰을 검색하고 해당 토큰을 사용하여 다른 서비스와 통신하도록 설정된 서비스가 있습니다. 내 로컬 개발 컴퓨터에서 ADFS 서비스를 실행하는 ADFS 창 혼합 끝점에 연결할 때 토큰을 successfuly 검색 할 수 있습니다.문제 ADFS 끝점에 연결할 때 서버에

Secure channel cannot be opened because security negotiation with the remote endpoint has failed. This may be due to absent or incorrectly specified EndpointIdentity in the EndpointAddress used to create the channel. Please verify the EndpointIdentity specified or implied by the EndpointAddress correctly identifies the remote endpoint. 

는 단순히 토큰을 얻는다 다음 코드를 사용하여 오류를 재현 할 수 있어요 : 나는 ADFS를 실행하는 동일한 시스템에서 내 서비스를 설치할 때, 나는 다음과 같은 오류가 발생합니다. 다시이 코드는 원격 서버에 연결되는 내 dev 컴퓨터에있을 때 작동하지만 서버에 직접있을 때는 실패합니다. 나는 둘 다에 동일한 사용자 자격 증명을 사용하고 있습니다. 아래의 코드를 사용하여 간단한 테스트 클라이언트 및 응용 프로그램 풀 자격 증명을 사용하여 IIS 웹 서비스 내에서 동일한 오류가 발생합니다.

private static SecurityToken GetToken() 
    { 
     string stsEndpoint = "https://adfsserver.com/adfs/services/trust/13/windowsmixed"; 
     string appliesTo = "http://domain.com/application/myapplication"; 

     var factory = new WSTrustChannelFactory(
      new WindowsWSTrustBinding(SecurityMode.TransportWithMessageCredential), 
      stsEndpoint); 
     factory.TrustVersion = TrustVersion.WSTrust13; 

     var rst = new RequestSecurityToken 
     { 
      RequestType = RequestTypes.Issue, 
      AppliesTo = new EndpointAddress(appliesTo), 
      KeyType = KeyTypes.Symmetric 
     }; 

     var channel = factory.CreateChannel(); 
     return channel.Issue(rst); 
    } 

ADFS 2.0 디버그를 위해 Windows 이벤트 로그에서 추적을 켰습니다. 서버에서 직접 windowsmixed 엔드 포인트를 치면 실제로 엔드 포인트에 도달하지 못한다는 사실을 알게하는 항목을받지 못합니다.

보안 로그에서 실행중인 서비스와 관련하여 많은 감사 오류가 발생합니다. 개체에 대한 핸들을 요청했습니다.

Subject: 
    Security ID:  DOMAIN\ODI$ODIController 
    Account Name:  ODI$ODIController 
    Account Domain:  DOMAIN 
    Logon ID:  0x1a574b5 

Object: 
    Object Server:  SC Manager 
    Object Type:  SERVICE OBJECT 
    Object Name:  WinHttpAutoProxySvc 
    Handle ID:  0x0 

Process Information: 
    Process ID:  0x1f8 
    Process Name:  C:\Windows\System32\services.exe 

Access Request Information: 
    Transaction ID:  {00000000-0000-0000-0000-000000000000} 
    Accesses:  Query status of service 
       Start the service 
       Query information from service 

    Access Reasons:  - 
    Access Mask:  0x94 
    Privileges Used for Access Check: - 

나는 저장된 자격 증명을 사용하여 usernamemixed 엔드 포인트에 액세스하고 적절한 토큰을받을 수 있어요, 그래서 심지어 ADFS 엔드 포인트와 통신 할 수 있도록 사용자를 인증 뭔가 것 같다.

위의 코드에서 특정 자격 증명을 설정하면 연결할 수 있습니다. 다시 한 번 같은 컴퓨터에서 내 Windows 사용자에게 올바른 자격 증명을 전달하지 않는다고 생각하게됩니다.

factory.Credentials.Windows.ClientCredential = new System.Net.NetworkCredential("UserID", "password1", "dev.domain"); 

제공 할 수있는 도움 주셔서 감사합니다.

브라이언

답변

1

나는 비슷한 문제가있었습니다. http://blogs.southworks.net/mwoloski/2009/07/17/getting-a-token-from-adfs-ex-geneva-server-using-wcf/

코드와 실제 예제의 차이점은 메시지 보안을 수정하여 클라이언트가 아닌 바인딩의 현재 보안 자격 증명을 사용한다는 것입니다. WIF 4.0을 사용하는 경우 WSTrustClient 대신 WSTrustChannelFactory를 사용하도록 코드를 수정해야합니다. 다른 코드는별로 변하지 않습니다.

공장에 대한 나의 코드는 다음과 같습니다

var binding = new WS2007HttpBinding(SecurityMode.TransportWithMessageCredential); binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows; binding.Security.Message.EstablishSecurityContext = false;

var factory = new WSTrustChannelFactory( binding, new EndpointAddress(new Uri(sts), EndpointIdentity.CreateUpnIdentity(adfsUpn)));

관련 문제