我开发了一个 WCF 自托管服务,我有两个基本的安全要求,因为它将通过 Internet 访问:
传输层应防止篡改和嗅探,尤其是检索身份验证凭据。这就是 SSL 所做的,但据我所见,设置 SSL 需要安装证书(可能通过使用普通证书文件的这个 hack除外),我不想这样做。
身份验证层应包含用户名/密码验证器。
我将我的服务配置为使用:
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
<transport clientCredentialType="Basic" />
</security>
即使传输层是 HTTP(不是 HTTPS),这是否会使 WCF 创建另一个等效于 SSL 的安全层?如果不是,在安全强度方面有什么区别?
此外,是否有任何方法可以在不使用 SSL 证书的情况下保护元数据端点(不是必需的,但将不胜感激)?
这是我的自托管服务的完整配置代码:
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<system.serviceModel>
<services>
<service name="MyService">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8000/Services" />
</baseAddresses>
</host>
<endpoint address ="MyService" binding="wsHttpBinding" contract="IMyService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="Binding1" maxReceivedMessageSize="2147483647">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName" />
<transport clientCredentialType="Basic" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="CR.Common.Services.CustomValidator, Common" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
谢谢!