问题描述
我刚开始试着写我使用的的例子作为我的模板。所以我启动VS2010开始我自己的项目,我注意到的第一件事是,有一个System.IdentityModel以及Microsoft.IdentityModel。当东西被添加到.NET Framework成为主流这通常发生。
I just starting out trying to write a federated claims provider I'm using the http://claimsid.codeplex.com/ examples as my template. 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. This usually happens when stuff gets added to the .Net framework becoming 'mainstream'.
这是这里的情况?
我应该使用哪一种?
推荐答案
在使用基于声明的身份验证/授权,那么你将需要使用Microsoft.IdentityModel因为这是Windows身份验证框架(WIF)的一部分。
When using Claims Based authentication/authorization, then you will need to use Microsoft.IdentityModel as that is part of the Windows Identity Framework (WIF).
该System.IdentityModel索赔是WCF堆栈的一部分。它被用于WIF之前索赔。从我的理解Microsoft.IdentityModel什么是建立在System.IdentityModel之上。
The System.IdentityModel claim is part of the WCF stack. It was used for Claims before WIF. From what I understand Microsoft.IdentityModel is built on top of System.IdentityModel.
WIF对System.IdentityModel的依赖。根据你在做什么,你可能需要两个引用。
WIF has a dependency on 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):
namespace Microsoft.IdentityModel.Claims
{
public class Claim
{
public Claim(string claimType, string value);
public Claim(System.IdentityModel.Claims.Claim claim, string issuer);
...
}
}
如果您在使用System.IdentityModel和Microsoft.IdentityModel的选择上,始终使用Microsoft.IdentityModel。
If you have the choice of using System.IdentityModel and Microsoft.IdentityModel, always use Microsoft.IdentityModel.
这篇关于是什么System.IdentityModel与放大器之间的差异;我应该使用Microsoft.IdentityModel哪一个呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!