4

このWSE3.0コードをWCFに変換しようとしています。

// we use Microsoft WSE 3.0 to insert the username token in the soap header.
// This strategy takes care of creating and inserting the Nonce and Created elements 
// for us, as well as creating a password digest based on Nonce, Created, and 
// the password itself.  Refer to the WS-Secutiry UsernameToken Profile 1.1
// specification at http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=wss.

Microsoft.Web.Services3.Security.Tokens.UsernameToken nametoken;
nametoken = new Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, password, Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendHashed);
Microsoft.Web.Services3.Design.Policy ClientPolicy = new Microsoft.Web.Services3.Design.Policy();

ClientPolicy.Assertions.Add(new UsernameOverTransportAssertion());
this._proxy.SetPolicy(ClientPolicy);
this._proxy.SetClientCredential<UsernameToken>(nametoken);

Microsoft.Web.Services3.Security.Tokens.PasswordOption.SendHashedダイジェストモード(上記のコード`)でパスワードを送信することを除いて、私はかなり近づいています:

TransportSecurityBindingElement transportBindingElement =
    SecurityBindingElement.CreateUserNameOverTransportBindingElement();
transportBindingElement.AllowInsecureTransport = true;
transportBindingElement.EnableUnsecuredResponse = true;
transportBindingElement.IncludeTimestamp = true;
var binding = new CustomBinding(new BindingElement[] { //
    transportBindingElement, //
    new TextMessageEncodingBindingElement() {
        MessageVersion = MessageVersion.Soap11
    }, //
    new HttpTransportBindingElement() {
        AuthenticationScheme = AuthenticationSchemes.Digest,
    }, //
});

上記は、パスワードをプレーンテキスト(ハッシュなし)で送信します。カスタムトークンシリアライザーを作成せずにこれを行うようにWCFを設定することは不可能であると述べている誰かと、同様のコードを変換しようとしている誰かへのこのリンクを見つけました。

この声明は正確ですか?

もしそうなら、このカスタムシリアライザーを作成して使用するには何をする必要がありますか?

このリンクは、次の式を示すコメントでリンクされているサイトのPDFと組み合わせると、良い出発点になる可能性がありますPassword_Digest = Base64 ( SHA-1 ( nonce + created + password ) )が、誰かが私が何から導き出す必要があるのか​​、WCFを使用する方法についてより良い説明があれば私の新しいシリアライザーそれを聞きたいです。

4

1 に答える 1

5

あなたは私の質問を見つけました:)

これは非常に興味深い問題です。MSは、安全でないシステムとAPIを作成していると非難されることがよくありました。そのため、MSの一部のエンジニアは、新しいAPIに対して安全なものとそうでないものについていくつかのアイデアを取り入れるようになりました。ダイジェストされたパスワードを持つUserNameTokenプロファイルは、まさにこの取り組みの結果です。十分に安全ではないと見なされているため、WCFから完全に省略されています。WCFが、ダイジェストされたパスワードを持つUserNameTokenプロファイルが非常に人気のある他のプラットフォームやフレームワークとの相互運用性のためのAPIでなくても、問題はありません。

はい、問題を解決したときにカスタムトークンシリアライザーを実行しました。トークンシリアライザーだけではありません。それを機能させるには、実際にはかなり多くのクラスを実装する必要があります。私のコードではなかったので、実装を共有しませんが、これを試すことができます。

于 2011-08-05T18:46:08.877 に答える