CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
CslaClaimsPrincipal.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CslaClaimsPrincipal.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>ClaimsPrincipal subclass that supports serialization by MobileFormatter</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Security.Principal;
11using System.Security.Claims;
12using System.Collections.Generic;
13
15{
19 [Serializable()]
20 public class CslaClaimsPrincipal : ClaimsPrincipal, ICslaPrincipal
21 {
26 : base(new ClaimsIdentity())
27 { }
28
33 public CslaClaimsPrincipal(ClaimsPrincipal principal)
34 : base(principal.Identities)
35 { }
36
43 : base(identity)
44 {
45 var baseidentity = (ClaimsIdentity)base.Identity;
46 if (identity.Roles != null)
47 foreach (var item in identity.Roles)
48 baseidentity.AddClaim(new Claim("http://schemas.microsoft.com/ws/2008/06/identity/claims/role", item));
49 }
50
55 public CslaClaimsPrincipal(IIdentity identity)
56 : base(identity)
57 { }
58
63 public CslaClaimsPrincipal(IEnumerable<ClaimsIdentity> identities)
64 : base(identities)
65 { }
66
72 public CslaClaimsPrincipal(IPrincipal principal)
73 : base(principal)
74 { }
75
81 public CslaClaimsPrincipal(System.IO.BinaryReader reader)
82 : base(reader)
83 { }
84
91 protected CslaClaimsPrincipal(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
92 : base(info, context)
93 { }
94
96 { }
97
99 { }
100
102 { }
103
105 { }
106 }
107}
ClaimsPrincipal subclass that supports serialization by SerializationFormatterFactory....
CslaClaimsPrincipal(IPrincipal principal)
Creates an instance of the object based on an existing principal object.
CslaClaimsPrincipal(System.IO.BinaryReader reader)
Creates an instance of the object from a binary stream.
CslaClaimsPrincipal(IEnumerable< ClaimsIdentity > identities)
Creates an instance of the type.
CslaClaimsPrincipal(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
Creates an instance of the object from BinaryFormatter or NDCS deserialization.
CslaClaimsPrincipal(IIdentity identity)
Creates an instance of the type.
CslaClaimsPrincipal()
Creates an instance of the type.
CslaClaimsPrincipal(ICslaIdentity identity)
Creates an instance of the object, initializing a role claim for each role in the identity's Roles co...
CslaClaimsPrincipal(ClaimsPrincipal principal)
Creates an instance of the type.
Serializes and deserializes objects at the field level.
Object containing the serialization data for a specific object.
Provides a base type to simplify creation of a .NET identity object for use with ICslaPrincipal.
MobileList< string > Roles
Gets the list of roles for this user.
Defines the base requirements for the interface of any CSLA principal object.
Interface to be implemented by any object that supports serialization by the SerializationFormatterFa...
void GetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should serialize its child references.
void GetState(SerializationInfo info)
Method called by MobileFormatter when an object should serialize its data.
void SetChildren(SerializationInfo info, MobileFormatter formatter)
Method called by MobileFormatter when an object should deserialize its child references.
void SetState(SerializationInfo info)
Method called by MobileFormatter when an object should be deserialized.
@ Serializable
Prevents updating or inserting until the transaction is complete.