简体   繁体   English

我应该使用System.IdentityModel和Microsoft.IdentityModel之间的区别是什么?

[英]What is the difference between System.IdentityModel & Microsoft.IdentityModel which one should I use?

I just starting out trying to write a federated claims provider I'm using the http://claimsid.codeplex.com/ examples as my template. 我刚开始尝试编写一个联合声明提供程序,而我使用http://claimsid.codeplex.com/示例作为模板。 So I start up VS2010 to begin my own project and the first thing I notice is that there is a System.IdentityModel as well as Microsoft.IdentityModel. 因此,我启动VS2010来开始自己的项目,而我注意到的第一件事是,除了System.IdentityModel之外,还有Microsoft.IdentityModel。 This usually happens when stuff gets added to the .Net framework becoming 'mainstream'. 这通常是在将东西添加到.Net框架中成为“主流”时发生的。

Is this the case here? 这是这种情况吗?

Which one should I use? 我应该使用哪一个?

When using Claims Based authentication/authorization, then you will need to use Microsoft.IdentityModel as that is part of the Windows Identity Framework (WIF). 使用基于声明的身份验证/授权时,您将需要使用Microsoft.IdentityModel,因为它是Windows身份框架(WIF)的一部分。

The System.IdentityModel claim is part of the WCF stack. System.IdentityModel声明是WCF堆栈的一部分。 It was used for Claims before WIF. 在WIF之前用于索赔。 From what I understand Microsoft.IdentityModel is built on top of System.IdentityModel. 据我了解,Microsoft.IdentityModel建立在System.IdentityModel之上。

WIF has a dependency on System.IdentityModel. WIF对System.IdentityModel有依赖性。 Depending on what you are doing you might need a reference to both. 根据您的操作,可能需要同时引用这两者。

This is an example, taken from the Claim type (that happens to be in both assemblies): 这是一个示例,取自Claim类型(恰好在两个程序集中):

namespace Microsoft.IdentityModel.Claims
{
    public class Claim
    {
        public Claim(string claimType, string value);
        public Claim(System.IdentityModel.Claims.Claim claim, string issuer);
        ...
    }
}

If you have the choice of using System.IdentityModel and Microsoft.IdentityModel, always use Microsoft.IdentityModel. 如果可以选择使用System.IdentityModel和Microsoft.IdentityModel,请始终使用Microsoft.IdentityModel。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft.IdentityModel与System.IdentityModel - Microsoft.IdentityModel vs System.IdentityModel IdentityModel vs Microsoft.IdentityModel vs System.IdentityModel - IdentityModel vs Microsoft.IdentityModel vs System.IdentityModel microsoft.identityModel迁移到system.Identity模型 - microsoft.identityModel migrate to system.Identity model 无法加载文件或程序集'Microsoft.IdentityModel - Could not load file or assembly 'Microsoft.IdentityModel 成员“ Microsoft.IdentityModel.Claims.ClaimsPrincipal,Microsoft.IdentityModel”的类型未解析 - Type is not resolved for member “Microsoft.IdentityModel.Claims.ClaimsPrincipal,Microsoft.IdentityModel” 剃刀视图(MVC .NET 4.0)和Microsoft.IdentityModel - Razor view (MVC .NET 4.0) and Microsoft.IdentityModel 部署到Plesk 12.5的ASP.NET MVC不能加载文件或程序集'Microsoft.IdentityModel - ASP.NET MVC Deployed to Plesk 12.5 throws Could not load file or assembly 'Microsoft.IdentityModel Umbraco 7-移动站点在尝试登录时出现Microsoft.IdentityModel错误 - Umbraco 7 - moving site getting a Microsoft.IdentityModel Error when trying to login 以编程方式在asp.net应用程序上的microsoft.identityModel中配置federatedAuthentication元素 - Programatically Configuring federatedAuthentication element in microsoft.identityModel on asp.net application 在ASP.NET应用程序上编程配置Microsoft.IdentityModel不起作用 - 已启用被动重定向但从未工作过 - Programmatical configuring Microsoft.IdentityModel on ASP.NET application not working - Passive Redirect enabled but never worked
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM