【问题标题】:microsoft.identityModel migrate to system.Identity modelmicrosoft.identityModel 迁移到 system.Identity 模型
【发布时间】:2015-07-11 00:10:27
【问题描述】:

我目前网上的STS配置如下,

<microsoft.identityModel>    
<service saveBootstrapTokens="true">
  <audienceUris mode="Never"/>
  <federatedAuthentication>
    <wsFederation passiveRedirectEnabled="true" issuer="https://fs.mysite.net/adfs/ls" realm="https://myweb.cloudapp.net/" reply="https://myweb.cloudapp.net/Account/FederatedResult" requireHttps="false"/>
    <cookieHandler requireSsl="false"/>
  </federatedAuthentication>
  <serviceCertificate>
    <certificateReference x509FindType="FindBySubjectName" findValue="*.mydomain.net"/>
  </serviceCertificate>
  <applicationService>
    <claimTypeRequired>
      <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" optional="true"/>
      <claimType type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" optional="true"/>
      <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="true"/>
    </claimTypeRequired>
  </applicationService>
  <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
    <trustedIssuers>
      <add thumbprint="a5069c80a92e7a49937bba9bc25a85a57b4bbc74" name="https://fs.myweb.net/adfs/services/trust"/>
    </trustedIssuers>
  </issuerNameRegistry>
  <certificateValidation certificateValidationMode="None"/>
</service>

下面需要引入MachineKeySessionSecurityTokenHandler,(在web farm环境中需要通过mahcinekey强制cookie加密)

<system.identityModel>
  <identityConfiguration>
    <securityTokenHandlers>
      <remove type="System.IdentityModel.Tokens.SessionSecurityTokenHandler, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      <add type="System.IdentityModel.Services.Tokens.MachineKeySessionSecurityTokenHandler, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </securityTokenHandlers>
  </identityConfiguration>
</system.identityModel>

但是 system.identityModel 中没有标签。 federatedAuthentication 标签也给出错误。有人可以帮我将 microsoft.identityModel 迁移到 system.identityModel 版本。

【问题讨论】:

    标签: asp.net-mvc cookies wif


    【解决方案1】:

    您是否将以下内容放在 web.config 的顶部?

    <configuration>
      <configSections>
        <section name="system.identityModel" type="System.IdentityModel.Configuration.SystemIdentityModelSection, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <section name="system.identityModel.services" type="System.IdentityModel.Services.Configuration.SystemIdentityModelServicesSection, System.IdentityModel.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
    

    【讨论】:

    • 我的 Web 配置中可以同时包含 Microsoft.Identity 模型和 system.identityModel 设置吗?还是我需要将 Microsoft.Identitymodel 迁移到较新的 System.Identitymodel 才能拥有 MachineKeySessionSecurityTokenHandler。
    • 只是想知道如何使用 Microsoft.Identity 模型设置在负载平衡环境中使用机器密钥进行 cookie 加密...
    猜你喜欢
    • 2019-07-12
    • 1970-01-01
    • 2021-01-18
    • 1970-01-01
    • 2012-08-18
    • 1970-01-01
    • 2020-11-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多