【问题标题】:Custom Saml2SecurityTokenHandler - The token Serializer cannot serialize自定义 Saml2SecurityTokenHandler - 令牌序列化程序无法序列化
【发布时间】:2011-07-25 15:14:56
【问题描述】:

为简单起见,我实现了以下类:

public class CustomUserNamePasswordValidatorSecurityTokenHandler : UserNameSecurityTokenHandler {}

我已经启用了它的配置(并启用了正确的 configSection):

  <microsoft.identityModel>
    <service>
      <securityTokenHandlers>
        <clear />
        <add type="CustomUserNamePasswordValidatorSecurityTokenHandler" />       
      </securityTokenHandlers>
    </service>
  </microsoft.identityModel>

并针对我的 STS 收益执行实际的 RP 调用(在服务跟踪查看器中):

令牌序列化程序无法序列化“Microsoft.IdentityModel.Tokens.SessionSecurityToken”。如果这是自定义类型,您必须提供自定义序列化程序。

如果我注释掉配置(因此没有应用令牌处理程序),一切正常。如何提供此自定义序列化程序?

注意:this thread 中有几个关于该问题的参考,但我没有看到解决方案。

【问题讨论】:

    标签: wif saml


    【解决方案1】:

    删除 securityTokenHandler 部分上的&lt;clear /&gt; 就足够了(我编辑可能会相应地回答您的other question,抱歉)。

    &lt;clear /&gt; 删除所有默认注册的处理程序(例如,对于 SessionSecurityToken)。

    【讨论】:

      猜你喜欢
      • 2013-09-09
      • 1970-01-01
      • 2020-12-12
      • 2017-01-21
      • 2010-11-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      相关资源
      最近更新 更多