21

Now this is odd. After completing some research on claims based solutions in .NET, found that different authors refer to different classes in .NET namespace when actually speaking on the same matter. Claim class (not to mention other Identity, Principal, Manager, Helper classes around) is defined in 3 different namespaces.

It is clear that WIF is separate add-on for .NET 3.5 and 4.0 and that it is rewritten and made part of core in 4.5. However it could really help to have clear directions on what class to use for new projects (so that port to 4.5 after could be easier). Does anybody else have more info on the subject?

1st link: http://msdn.microsoft.com/en-us/library/ms572956(v=vs.110) (System.IdentityModel.Claims namespace)

2nd: http://msdn.microsoft.com/en-us/library/microsoft.identitymodel.claims.claim.aspx (Microsoft.IdentityModel.Claims)

3rd: (System.Security.Claims.Claim)

4

3 に答える 3

32

これに対する決定的な答えをまだ探している人のために、MSDN にはSystem.IdentityModel.Claims Namespaceページに関する次の情報があります...

System.IdentityModel.Claims 名前空間には、Windows Communication Foundation (WCF) のクレーム ベースの ID 承認モデルを実装するクラスが含まれています。このモデルには、Claim クラスと ClaimSet クラスが含まれます。

.NET Framework 4.5 および Windows Identity Foundation (WIF) の .NET Framework への統合以降、WCF クレームベース ID モデルは WIF に取って代わられました。WIF は、CLR、WCF、ASP.NET など、複数の Microsoft 製品スタックで認証と承認を提供するために使用できるクレーム ベースの ID オブジェクト モデルを提供します。クレーム、クレームの種類、およびクレームに基づく ID とプリンシパルを表す WIF クラスは、 System.Security.Claims名前空間に含まれています。.NET 4.5 以降では、System.IdentityModel.Claims 名前空間のクラスではなく、これらのクラスを使用する必要があります。

于 2014-02-11T12:31:00.663 に答える
8

Microsoftの回答はようSystem.Security.Claimsに思わSystem.IdentityModelSystem.IdentityModel.Servicesます: System.Security.Claims_主に(パイプライン、WCF 統合) および( WS-Federation のサポート、セッション管理)に広がっています。これらの変更は構成セクションにも反映されています。"ClaimsPrincipalClaimsIdentityClaimsPrincipalMicrosoft.IdentityModelSystem.IdentityModelSystem.IdentityModel.Services

于 2012-10-15T13:03:50.040 に答える
5

System.IdentityModel.ClaimsWCF/.Net 3.0 の一部です

Microsoft.IdentityModel.Claims拡張System.IdentityModel.Claimsされ、Windows Identity Foundation クラスです。

System.Security.Claims.Net 4.5 バージョンです。

したがって、 を使用して記述している場合はWIF、 を使用する必要がありますMicrosoft.IdentityModel.Claims

于 2012-07-31T20:24:34.717 に答える