wif - unable to Inherit from System.Security.Claims.ClaimsPrincipal -


mvc5 controllers have user property system.security.claims.claimsprincipal

i've created base controller inherit from. base controller's user property overridden mycustomprinciple inherits system.security.claims.claimsprincipal

 public abstract partial class basecontroller : controller     {          public new mycustomprinciple user         {                         {                 return base.user mycustomprinciple;  //returns null here             }         }      }  public class mycustomprinciple : system.security.claims.claimsprincipal     {         private int _id;          public int id         {             { return _id; }             set { _id = value; }         }      } 

as can see above fails on cast. i'm unsure why did similar thing in mvc4 inherited principle system.security.principal.iprincipal controllers user property type of.

you're missing point of claimsprincipal -- claims collection you'd keep app-specific identity data. i'd suggest adding extension methods extract specific claims "id".


Comments