2013-12-20 4 views
1

HTTPS에서 UserName 자격 증명을 사용하여 실행해야하는 WCF 서비스를 개발 중이며 IIS에서 실행되는 테스트 솔루션에서 다음 구성을 사용할 수 있습니다.HTTPS를 사용하여 WCF 서비스 구성

서버 설정 :

<?xml version="1.0"?> 
<configuration> 

    <system.web> 
    <compilation debug="true" targetFramework="4.5" /> 
    <httpRuntime targetFramework="4.5" /> 
    <customErrors mode="Off" /> 
    </system.web> 

    <system.serviceModel> 

    <behaviors> 
     <serviceBehaviors> 
     <behavior name="Behavior1"> 
      <serviceMetadata httpsGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
      <serviceCredentials> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Service.UserNamePassValidator, Service" /> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    <bindings> 
     <wsHttpBinding> 
     <binding name="Binding1"> 
      <security mode="TransportWithMessageCredential"> 
      <transport clientCredentialType="None" /> 
      <message clientCredentialType="UserName" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 

    <services> 
     <service behaviorConfiguration="Behavior1" name="Service.Service"> 
     <host> 
      <baseAddresses> 
      <add baseAddress="https://localhost/" /> 
      </baseAddresses> 
     </host> 
     <endpoint address="" binding="wsHttpBinding" bindingConfiguration="Binding1" contract="Service.IService" /> 
     <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 

    </system.serviceModel> 

</configuration> 

클라이언트 설정 : 내 시나리오에서

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <system.serviceModel> 

    <bindings> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_IService"> 
      <security mode="TransportWithMessageCredential"> 
      <transport clientCredentialType="None" /> 
      <message clientCredentialType="UserName" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 

    <client> 
     <endpoint address="https://localhost:44303/UsernamePasswordService.svc" 
     binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService" 
     contract="ServiceReference1.IService" name="WSHttpBinding_IService" /> 
    </client> 

    </system.serviceModel> 
</configuration> 

클라이언트가 윈폼 응용 프로그램입니다.

저는 이것을 구성하는 데있어서 매우 새로운 것으로, 이것이 UserName 자격증 명과 함께 HTTPS (SSL)에 대한 유효한/좋은 설정인지 확인하고 싶습니다.

자체 서명 인증서를 사용하고 있기 때문에 클라이언트 측에서 인증서의 유효성 검사를 무시해야하므로 유효 인증서로 어떻게 작동하는지 명확하게 볼 수있는 것처럼 느껴지지 않습니다.

내가 상상 한 방식은 서버가 통신을 시작할 때 클라이언트 인증서를 클라이언트에 전달한 다음 클라이언트가 클라이언트 인증서로 서버에 보내는 모든 트래픽을 암호화한다는 것입니다. 그런 다음이 트래픽은 서버 끝의 서버 인증서로 해독됩니다.

그러나 이것이 작동하는 방식입니까? 이제 구성되는 방식으로 인증서는 IIS 수신 대기 포트에만 지정되므로 각 요청에 대해 서버 인증서를 기반으로 클라이언트 인증서를 생성합니까? 아니면 클라이언트의 트래픽이 암호화되지 않을 것인가?

내 요청에 대해 피들러를 실행하고 HTTPS의 암호를 해독 할 수 있었고 XML의 일반 텍스트로 사용자 이름과 암호를 읽을 수 있음을 알았습니다. 이것은 피들러가 내 인증서 암호화를 읽으려는 마술을하거나 암호화되지 않은 메시지를 보내려고하기 때문입니까?

그런 경우 데이터를 직접 암호화하고 해독해야합니까?

클라이언트에 인증서를 설치하고 싶지 않습니다.

답변

0

첫 번째 질문에 대한 짧은 대답은 내 의견으로는 사용자 이름 자격 증명이있는 HTTPS (SSL)가 유효한 보안 구성이 될 수 있다는 것입니다. WSHttpBinding을 사용하면 WS-Security 사양을 구현하고 WS- * 사양을 구현하는 서비스와의 상호 운용성을 제공합니다.

참조 : http://msdn.microsoft.com/en-us/library/ms731172(v=vs.110).aspx

더 평가를 제공하기 위해, 하나는 시스템의 요구 사항에 대한 해당 솔루션의 보안을 비교해야합니다.

정직하게 말하면, 나머지 질문에 대해서는 완전히 이해하지 못했지만 고객이 자체 서명 된 인증서를 사용함에 대한 의문에 대해 걱정할 필요가 있습니다.

http://msdn.microsoft.com/en-us/library/ff648840.aspx
http://www.codeproject.com/Articles/570539/HTTPSplusCommunicationplusinplusWCFplususingplusSe
http://blog.adnanmasood.com/2010/04/29/step-by-step-guide-for-authenticating-wcf-service-with-username-and-password-over-ssl/

: 그 다음 링크 (하나 이상) 몇 가지 지침을 제공해야했다
관련 문제