This fixed a runtime exception when trying to get a ClaimsPrincipal from an IIdentity.
Noticed this work working with aspnet Identity in a Web Api 2 controller.
Exception fired when running User.Identity.IsAuthenticated.
Exception detail:
http://falk.pw:7777/tocehuhemo.xml
foreach (var c in ci.Claims)
this.claims.Add (c);
- foreach (var c in claims)
- this.claims.Add (c);
+ if (claims != null) {
+ foreach (var c in claims)
+ this.claims.Add (c);
+ }
Label = ci.Label;
NameClaimType = ci.NameClaimType;
RoleClaimType = ci.RoleClaimType;
}
}
}
-#endif
\ No newline at end of file
+#endif
{
if (identity == null)
throw new ArgumentNullException ("identity");
- // TODO
+
+ identities = new List<ClaimsIdentity> ();
+ identities.Add (new ClaimsIdentity (identity))
}
public ClaimsPrincipal (IPrincipal principal)
}
}
-#endif
\ No newline at end of file
+#endif