[英]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.