2

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'.

Is this the case here?

Which one should I use?

Peter
  • 7,792
  • 9
  • 63
  • 94

1 Answers1

4

When using Claims Based authentication/authorization, then you will need to use Microsoft.IdentityModel as that is part of the Windows Identity Framework (WIF).

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 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);
        ...
    }
}

If you have the choice of using System.IdentityModel and Microsoft.IdentityModel, always use Microsoft.IdentityModel.

dnatoli
  • 6,972
  • 9
  • 57
  • 96
  • 5
    Update for 4.5 -> [MSDN](http://msdn.microsoft.com/en-us/library/microsoft.identitymodel.claims.claimsauthenticationmanager.aspx): Starting with the .NET Framework 4.5, Windows Identity Foundation (WIF) has been fully integrated into the .NET Framework. The version of WIF addressed by this topic, WIF 3.5, is deprecated and should only be used when developing against the .NET Framework 3.5 SP1 or the .NET Framework 4. For more information about WIF in the .NET Framework 4.5, also known as WIF 4.5, see the Windows Identity Foundation documentation in the .NET Framework 4.5 Development Guide – felickz Feb 05 '13 at 16:32