【发布时间】:2013-01-30 19:06:55
【问题描述】:
我正在使用 .NET 4.5 中的 WIF (System.IdentityModel) 类创建 STS。此 STS 需要处理 ActAs 令牌。我已经成功地将客户端原型化为发送 ActAs 令牌,这会导致服务器端出现以下错误消息:
ID3265:找到 ActAs 元素,但没有注册令牌处理程序来读取 ActAs 元素。考虑将有效的 SecurityTokenHandlerCollection 添加到 SecurityTokenHanderCollectionManager 以供 ActAs 使用。
但是,我认为无法将SecurityTokenHandlerCollection 添加到SecurityTokenHanderCollectionManager。这是怎么做到的?
我已经尝试了this 文档中的建议:
<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(字符串使用)
请注意,this 文档提供的信息与 1 基本相同,但专门针对 .NET 4.5。
如何处理 ActAs 令牌?
【问题讨论】: