In the last couple of posts, I’ve written about the claims and security token concepts, and also about how WCF models them:
- What are claims?
- Claims and claims sets in WCF
- What are security tokens?
- Security tokens in WCF
- Authorization policies in WCF: from tokens to claim sets
- The ServiceAuthorizationManager class in WCF
In this post I will start writing about how these concepts are modeled in Zermatt:
Disclaimer: my conclusions and remarks are based solely on public documentation and on observing the code of the beta release, so use them at your own risk.
A new claims model
Zermatt introduces a new class model for claims, implemented in the Microsoft.IdentityModel namespace and depicted in the following figure This new model extends the classical .NET model, based on the IPrincipal and IIdentity interfaces, by creating two specialized interfaces: IClaimsPrincipal and IClaimsIdentity IClaimsIdentity
The IClaimsIdentity interface, derived from the .NET framework’s IIdentity interface, represents a claims-based identity. It contains the Claims property, that references a collection of claims. There are some differences in the representation of claims, when compared with the “older” System.IdentityModel model.
The NameClaimType property of IClaimsPricipal is used to define the value of the Name property (inherited from IIdentity): this value is the value of the claim whose type equals NameClaimType. Finally, the IClaimsIdentity also possesses a Delegate property, of type IClaimsIdentity. This property is used in delegation scenarios, and will be described in a future post. IClaimsPrincipal Note that the base interface IPrincipal already had a Identity property. The new Identities property (plural) is need because a principal can be associated with several identities, e. g., on delegation scenarios. The implementation of the IsInRole interface method should/can use the RoleClaimTypes property of the identities referenced by the Identities property. ClaimsPrincipal The Zermatt’s claims model also contains an implementation of IClaimsPrincipal, called ClaimsPrincipal, with a static Current property – the IClaimsPrincipal associated with the current context.
A claim is represented by the Claim class, namely by three properties:
The ClaimTypes class contains a set of constants with some used claim types (strings).
The RoleClaimsType property has a similar goal: it defines the types of claims that define roles. This is used by classes implementing the IClaimPrincipal interface.
This new model also introduces the IClaimPrincipal as a specialization of the .NET framework’s IPrincipal interface. Namely, this new interface adds a Identities collection that references a set of IClaimIdentity.
[...] 14, 2008 by pedrofelix In the last post, I briefly presented Zermatt’s claims model. This model can be used in both WCF based [...]
[...] class model, present in the Microsoft.IdentityModel.dll assembly, is similar to the one present in the code name “Zermatt” framework. One important difference is that issuers are not represented by IClaimsIdentity objects but by [...]