私は WCF セルフホステッド サービスを開発しました。このサービスには、インターネット経由でアクセスするため、次の 2 つの基本的なセキュリティ要件があります。
トランスポート層は、改ざんやスニッフィング、特に認証資格情報の取得を防止する必要があります。これは SSL が行うことですが、私が見たところ、SSL のセットアップには証明書のインストールが必要です (プレーンな証明書ファイルを使用するこのハックを除く)。
認証レイヤーは、ユーザー名/パスワードバリデーターで構成する必要があります。
以下を使用するようにサービスを構成しました。
<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>
ありがとうございました!