mscorlib(4.0.0.0) API with additions
GenericIdentity.cs
5 
7 {
9  [Serializable]
10  [ComVisible(true)]
12  {
13  private string m_name;
14 
15  private string m_type;
16 
19  public override IEnumerable<Claim> Claims => base.Claims;
20 
23  public override string Name => m_name;
24 
27  public override string AuthenticationType => m_type;
28 
32  public override bool IsAuthenticated => !m_name.Equals("");
33 
37  [SecuritySafeCritical]
38  public GenericIdentity(string name)
39  {
40  if (name == null)
41  {
42  throw new ArgumentNullException("name");
43  }
44  m_name = name;
45  m_type = "";
46  AddNameClaim();
47  }
48 
53  [SecuritySafeCritical]
54  public GenericIdentity(string name, string type)
55  {
56  if (name == null)
57  {
58  throw new ArgumentNullException("name");
59  }
60  if (type == null)
61  {
62  throw new ArgumentNullException("type");
63  }
64  m_name = name;
65  m_type = type;
66  AddNameClaim();
67  }
68 
69  private GenericIdentity()
70  {
71  }
72 
75  protected GenericIdentity(GenericIdentity identity)
76  : base(identity)
77  {
78  m_name = identity.m_name;
79  m_type = identity.m_type;
80  }
81 
84  public override ClaimsIdentity Clone()
85  {
86  return new GenericIdentity(this);
87  }
88 
89  [OnDeserialized]
90  private void OnDeserializedMethod(StreamingContext context)
91  {
92  bool flag = false;
93  using (IEnumerator<Claim> enumerator = base.Claims.GetEnumerator())
94  {
95  if (enumerator.MoveNext())
96  {
97  Claim current = enumerator.Current;
98  flag = true;
99  }
100  }
101  if (!flag)
102  {
103  AddNameClaim();
104  }
105  }
106 
107  [SecuritySafeCritical]
108  private void AddNameClaim()
109  {
110  if (m_name != null)
111  {
112  base.AddClaim(new Claim(base.NameClaimType, m_name, "http://www.w3.org/2001/XMLSchema#string", "LOCAL AUTHORITY", "LOCAL AUTHORITY", this));
113  }
114  }
115  }
116 }
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
bool MoveNext()
Advances the enumerator to the next element of the collection.
Definition: __Canon.cs:3
GenericIdentity(GenericIdentity identity)
Initializes a new instance of the T:System.Security.Principal.GenericIdentity class by using the spec...
Describes the source and destination of a given serialized stream, and provides an additional caller-...
Supports a simple iteration over a generic collection.
Definition: IEnumerator.cs:6
override string AuthenticationType
Gets the type of authentication used to identify the user.
Represents a claim.
Definition: Claim.cs:10
Represents a claims-based identity.
new T Current
Gets the element in the collection at the current position of the enumerator.
Definition: IEnumerator.cs:12
GenericIdentity(string name)
Initializes a new instance of the T:System.Security.Principal.GenericIdentity class representing the ...
override string Name
Gets the user's name.
override bool IsAuthenticated
Gets a value indicating whether the user has been authenticated.
GenericIdentity(string name, string type)
Initializes a new instance of the T:System.Security.Principal.GenericIdentity class representing the ...
override ClaimsIdentity Clone()
Creates a new object that is a copy of the current instance.
override IEnumerable< Claim > Claims
Gets all claims for the user represented by this generic identity.