2

.NET 4.5 でWIF ( System.IdentityModel) クラスを使用して STS を作成しています。この STS は、ActAs トークンを処理する必要があります。ActAs トークンを送信するクライアントのプロトタイプが正常に作成されました。これにより、サーバー側で次のエラー メッセージが表示されます。

ID3265: ActAs 要素が見つかりましたが、ActAs 要素を読み取るために登録されたトークン ハンドラーがありませんでした。ActAs を使用するために、SecurityTokenHandlerCollectionManager に有効な SecurityTokenHandlerCollection を追加することを検討してください。

ただし、 に a を追加する方法はありませSecurityTokenHandlerCollectionSecurityTokenHanderCollectionManager。これはどのように行われますか?

このドキュメントで提案されていることを試しました:

<securityTokenHandlers name="ActAs">
    ...
</securityTokenHandlers>

しかし、その結果、次のエラーが発生します。

ID0005: 入力 'configElement.ElementInformation.Properties' コレクションには、'ActAs' という名前のプロパティが含まれていません。

「同等の」(そのドキュメントによると)呪文ServiceConfiguration.SecurityTokenHandlerCollectionManager["ActAs"]は、同様に役に立たない:

未処理の例外: System.Collections.Generic.KeyNotFoundException: 指定されたキーがディクショナリに存在しませんでした。System.Collections.Generic.Dictionary`2.get_Item (TKey キー) で System.IdentityModel.Tokens.SecurityTokenHandlerCollectionManager.get_Item (文字列の使用) で

このドキュメントは基本的に1と同じ情報を提供しますが、特に .NET 4.5 用であることに注意してください。

ActAs トークンはどのように処理すればよいですか?

4

1 に答える 1

1

The indexer on SecurityTokenHandlerCollectionManager is not read-only:

// Summary:
//     Returns the security token handler collection for the specified usage.
//
// Parameters:
//   usage:
//     The usage name for the token handler collection.
//
// Returns:
//     The token handler collection associated with the specified usage.
public SecurityTokenHandlerCollection this[string usage] { get; set; }

Simply set the SecurityTokenHandlerCollection for the given key to the desired collection:

SecurityTokenHandlerCollectionManager["ActAs"] = new SecurityTokenHandlerCollection();
// or:
SecurityTokenHandlerCollectionManager[SecurityTokenHandlerCollectionManager.Usage.ActAs] = new SecurityTokenHandlerCollection();
于 2013-01-30T20:22:32.637 に答える