claimType需要在WIF 4.5应用程序中 [英] claimTypeRequired in a WIF 4.5 app

查看:107
本文介绍了claimType需要在WIF 4.5应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个ADFS 2.0服务器并使用示例代码在VS 2010中使用WIF 4.0获取声明感知应用。 
添加STS参考命令为我排序了所有内容并且工作正常:我在页面上看到了一系列声明。


现在我是试图在VS 2012中做同样的事情。 我添加了身份和访问扩展程序,但它没有与添加STS参考资料相同的功能。  添加STS参考资料之一就是填充

< claimTypeRequired> 
< / claimTypeRequired>


,包含STS提供的索赔清单。 然后,可以轻松自定义要求的声明和所需的声明。 然后,重新运行该实用程序将使用ClaimTypesRequested为该站点填充FederationMetadata.xml:

< fed:ClaimTypesRequested> 
< auth:ClaimType Uri ...
< / fed:ClaimTypesRequested>


我找不到一个简单的方法来为WIF 4.5做这个是否有一个应用程序。是否有一个?

附加:


尽管claimTypeRequired是架构的一部分(参见
这里
),我得到分析器错误信息:无法识别的元素 'claimTypeRequired'。当我将它们从我的Visual Studio 2010应用程序的web.config复制到WIF 4.5 web.config时。



解决方案

在尝试转换.NET 4.0 WebApp之后,这一直困扰着我Azure到.NET 4.5。我通过以下配置得到运行时配置错误: 


配置:




  < system.identityModel>

    < identityConfiguration>

      < audienceUris>

        < add value =" https://............./ " />
$
      < / audienceUris>

      < certificateValidation certificateValidationMode =" None" />
$
      < claimTypeRequired>

        < claimType type =" http://schemas.xmlsoap.org/ws/2005/05性/同一性/权利要求/ privatepersonalidentifier "可选= QUOT假QUOT; />
$
        < claimType type =" http://schemas.xmlsoap.org/ws/2005/05性/同一性/权利要求/ EMAILADDRESS "可选= QUOT假QUOT; />
$
      < / claimTypeRequired>

      < issuerNameRegistry类型= QUOT; System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry,System.IdentityModel,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089">

&NBSP;&NBSP;&NBSP;&NBSP ;&NBSP;&NBSP;&NBSP; < trustedIssuers>

          < add thumbprint =" .................."命名= QUOT; ................" />
$
        < / trustedIssuers>

      < / issuerNameRegistry>

    < / identityConfiguration>

  < /system.identityModel>




错误:


服务器错误' /'申请。

-------------------------------------- ------------------------------------------


配置错误

 描述:处理为此请求提供服务所需的配置文件时发生错误。请查看下面的具体错误详细信息并相应地修改配置文件。


 解析器错误消息:无法识别的元素'claimTypeRequired'。


源错误:


<第75行:       < / audienceUris>
$
第76行:       < certificateValidation certificateValidationMode =" None" />
$
第77行:       < claimTypeRequired>
$
第78行:         < claimType type =" http://schemas.xmlsoap.org/ws/2005/05性/同一性/权利要求/ privatepersonalidentifier "可选= QUOT假QUOT;
/>
$
第79行:         < claimType type =" http://schemas.xmlsoap.org/ws/2005/05性/同一性/权利要求/ EMAILADDRESS "可选= QUOT假QUOT; />


 源文件:  C:\Users\ ........ \web.config&NBSP;&NBSP;&NBSP;行:&NBSP; 77


I've built an ADFS 2.0 server and used sample code to get a claims aware app using WIF 4.0 in VS 2010.  The Add STS Reference command sorted everything out for me and it worked: I saw a list of claims on the page.

Now I'm trying to do the same thing in VS 2012.  I've added the Identity and Access extension but it doesn't have the same functionality as Add STS Reference.  One of the things Add STS Reference used to do was populate

<claimTypeRequired>
</claimTypeRequired>

with the list of claims offered by the STS.  It was then easy to customise which claims were requested and which were required.  Re-running the utility would then populate FederationMetadata.xml for the site with the ClaimTypesRequested:

  <fed:ClaimTypesRequested>
    <auth:ClaimType Uri...
  </fed:ClaimTypesRequested>

I can't find an easy way of doing this for a WIF 4.5 app in Visual Studio 2012. Is there one?

ADDITIONAL:

Even though claimTypeRequired is part of the schema (see here), I got Parser Error Message: Unrecognized element 'claimTypeRequired'. when I copied them from my Visual Studio 2010 app's web.config to the WIF 4.5 web.config.

解决方案

This has been plaguing me as well after trying to convert a .NET 4.0 WebApp for Azure to .NET 4.5. I get a runtime configuration error with the following configuration: 

Configuration:


  <system.identityModel>
    <identityConfiguration>
      <audienceUris>
        <add value="https://............./" />
      </audienceUris>
      <certificateValidation certificateValidationMode="None" />
      <claimTypeRequired>
        <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" optional="false" />
        <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="false" />
      </claimTypeRequired>
      <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <trustedIssuers>
          <add thumbprint=".................." name="................" />
        </trustedIssuers>
      </issuerNameRegistry>
    </identityConfiguration>
  </system.identityModel>


Error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error
  Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

 Parser Error Message: Unrecognized element 'claimTypeRequired'.

Source Error:

Line 75:       </audienceUris>
Line 76:       <certificateValidation certificateValidationMode="None" />
Line 77:       <claimTypeRequired>
Line 78:         <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier" optional="false" />
Line 79:         <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" optional="false" />

 Source File:  C:\Users\........\web.config    Line:  77


这篇关于claimType需要在WIF 4.5应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆