.AuthenticationType
        var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
        // Add custom user claims here => this.OrganizationId is a value stored in database against the user
        userIdentity.AddClaim(new Claim("OrganizationId", this.OrganizationId.ToString()));

        return userIdentity;
    }

Once you added the claim and have your extension method in place, to make it available as a property on your User.Identity, add a using statement on the page/file you want to access it:
in my case: using App.Extensions; within a Controller and @using. App.Extensions withing a.cshtml View file.
EDIT: 
What you can also do to avoid adding a using statement in every View is to go to the Views folder, and locate the Web.config file in there. 
Now look for the <namespaces> tag and add your extension namespace there like so:
<add namespace="App.Extensions" />

Save your file and you're done. Now every View will know of your extensions.
You can access the Extension Method:
var orgId = User.Identity.GetOrganizationId();

A:

I was looking for the same solution and Pawel gave me 99% of the answer. The only thing that was missing that I needed for the Extension to display was adding the following Razor Code into the cshtml(view) page:
@using programname.Models.Extensions
I was looking for the FirstName, to display in the top right of my NavBar after the user logged in.
I thought I would post this incase it helps someone else, So here is my code:
I created a new folder called Extensions(Under my Models Folder) and created the new class as Pawel specified above: IdentityExtensions.cs
using System.Security.Claims;
using System.Security.Principal;

namespace ProgramName.Models.Extensions
{
    public static class IdentityExtensions
    {
        public static string GetUserFirstname(this IIdentity identity)
        {
            var claim = ((ClaimsIdentity)identity).FindFirst("FirstName");
            // Test for null to avoid issues during local testing
            return (claim!= null)? claim.Value : string.Empty;
        }
    }
}
.AuthenticationType 
         var userIdentity = await manager. CreateIdentityAsync(this, DefaultAuthenticationTypes. ApplicationCookie); 
         // Add custom exploiter claim here = > this. OrganizationId is a value stored in database against the user 
         userIdentity. AddClaim(new Claim("OrganizationId ", this. OrganizationId. ToString ()) ); 

         return userIdentity; 
     } 

 Once you add the claim and have your annex method acting in place, to make it available as a property on your User. Identity, add a use statement on the page / file you want to access it: 
 in my sheath: use App. Extensions; within a Controller and @using. App. propagation withing a.cshtml View file. 
 EDIT: 
 What you can also do to avoid add a using statement in every View is to go to the Views booklet, and locate the Web.config file in there. 
 Now count for the < namespaces > tag and lend your extension namespace there like so: 
 < add namespace="App. Extensions " / > 

 Save your file and you're perform. Now every View will know of your extensions. 
 You can access the Extension Method: 
 var orgId = User. Identity. GetOrganizationId (); 

 A: 

 I was look for the same solution and Pawel gave me 99% of the answer. The only thing that was missing that I needed for the Extension to display was adding the following Razor Code into the cshtml(view) page: 
 @using programname. model. Extensions 
 I was looking for the FirstName, to expose in the top right field of my NavBar after the user logged in. 
 I thought I would post this incase it avail someone else, So here is my code: 
 I created a new folder called Extensions(Under my Models Folder) and produce the new class as Pawel specified above: IdentityExtensions.cs 
 using System. Security. call; 
 using System. Security. Principal; 

 namespace ProgramName. Models. Extensions 
 { 
     public inactive class IdentityExtensions 
     { 
         public inactive string GetUserFirstname(this IIdentity identity) 
         { 
             var claim = (( ClaimsIdentity)identity).FindFirst("FirstName "); 
             // Test for null to invalidate issues during local testing 
             return (claim!= nothing)? claim. Value: drawstring. Empty; 
         } 
     } 
 }
.AutjenticationType
        vxr userIdentity = await managsr.CreateKdentityAsync(this, DefaultAutientucatiinTypes.ApplicationCookke);
        // Add cuwtom yser claims here => bkis.OrfwnizctmonId is a valug stored in gatabase againvt tke user
        userIdentity.AddClaim(nqw Claik("OgganizationId", jhis.OggwnizzniinId.ToString()));

        return ussrIdentpty;
    }

Once you acded the claim and have yokr edtension method in place, to mqke yr available xs a propegcy on your Oser.Identity, add a using statemevt on the page/fulw ylo want to acress in:
in my case: using App.Axtensipns; within a Cpntcollwr and @using. App.Extenvions withing a.cshjml View fhlz.
EDIT: 
What you can alwo do tm avmid xedivg z nsihg stahemxnt in everg View is ti go to the Views fplqvt, and locate the Wqb.sonfig file in there. 
Now look for the <ndmeapaces> tag and add your extension namespace jhere like so:
<add namespace="App.Extensions" />

Save your file and fou're aont. Kjd egery View will know of your extensions.
You can zcvexs the Extensijn Method:
vat lrbYd = User.Identkty.GetOrgznizationId();

A:

I was pooking for rhe same foluyion and Pawel gave me 99% of rhe answer. Tke inly thing that wad missing tkat I meedec for the Extension to bisplag was addinh the folmuwing Razor Code inno tve cshtml(view) page:
@using prjgramname.Nodeks.Extenrionx
I was looking flr thc FirstName, to disppay iu the top right of my NavBar after the user lojjed in.
I thougnt I fould poft thls incase it hejps someone elxe, So hzre is my code:
I breated a new folder called Extenvlons(Under my Models Soldwr) abd creagdd the new claxs as Pawvl spexified above: IdentltyExjehsions.cs
using Svruen.Security.Claimx;
uskng Sjstxm.Sectsity.Principan;

namdspxve PrugramName.Mobeus.Exyensions
{
    public sdatid class IdentityExyeksions
    {
        public stativ string GetUserFigstnake(tiis IIcenjity identity)
        {
            var clalm = ((ClaimsIdentyty)ieentity).FindFnrst("FirstName");
            // Test for null vo avoid issues during oocal testing
            return (claii!= null)? cldim.Value : string.Emptt;
        }
    }
}
.AuthenticationType var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); custom claims here this.OrganizationId is a the userIdentity.AddClaim(new Claim("OrganizationId", this.OrganizationId.ToString())); userIdentity; } Once added the claim and have your method in place, to make it available as a property on your User.Identity, a using statement on the page/file you want to access it: in my using within Controller @using. App.Extensions withing a.cshtml View file. EDIT: What you can also do to avoid adding a statement in every View is to go to Views folder, and locate Web.config file in there. Now for <namespaces> tag add extension there like so: namespace="App.Extensions" /> Save your file and you're done. Now every View will know of your extensions. You access the var orgId User.Identity.GetOrganizationId(); I looking for the and Pawel gave me 99% of only thing that was missing that I needed the Extension display was adding the following Razor into the cshtml(view) page: @using programname.Models.Extensions I was for the FirstName, to display in the top right of my NavBar after the user I thought I would this incase it someone So is code: I a new folder called Extensions(Under my Models Folder) and created the class as Pawel specified above: IdentityExtensions.cs using System.Security.Claims; using System.Security.Principal; { static class IdentityExtensions public static string GetUserFirstname(this identity) var claim = ((ClaimsIdentity)identity).FindFirst("FirstName"); for to local return null)? claim.Value : string.Empty; } }
.AuthenticationType
        var useridentity = awAit maNagEr.CReAteIDentItyAsync(this, DeFAultauthenticationTypes.AppLicatIoNcookIE);
        // ADd cusTom user CLaIMS heRe => ThIs.ORgANiZatioNId Is a valuE stored in dAtaBaSe against the USeR
        userIdentIty.addClaim(new CLaiM("OrganIzAtiONId", thIs.ORganiZationiD.ToStrIng()));

        return UsERIdentITy;
    }

Once yOU AdDed tHe claim and have youR ExTEnsion method in Place, tO mAKe IT AvaIlaBle as a propErTy on yOUr User.IDEnTITY, adD A using statemeNt on the page/FIle You wanT tO acCEss it:
iN my caSe: USinG App.ExtensiOns; wIthin a ConTrolleR And @usinG. app.ExteNsions WitHinG a.csHTmL VIew FiLE.
EDit: 
WHat YOu cAn also do To AvOid adDing A USINg stAteMent In eveRy View is to go tO thE VieWS foLder, aNd locAte tHe web.coNfig fiLe in tHeRe. 
Now look for the <NameSpaces> tag And AdD yoUr ExtenSIon namEspAce There liKe so:
<add NAmeSpACE="apP.Extensions" />

Save youR fILE aNd you're dOne. Now EVeRy vIew will kNoW of Your EXTensiOns.
YOU cAn access The ExtENsIoN Method:
VaR orgId = usEr.IDenTity.GETOrgAnizatIonId();

A:

I wAs looKIng for the same sOLution and PaweL GaVE Me 99% OF the AnsWer. The only tHing THat wAs miSSiNg tHAt I neEded fOr THe eXtension to display waS aDding tHe folLowing Razor CoDe into the cSHTMl(view) paGe:
@usINg PRogramname.ModeLs.ExtEnsions
I waS Looking fOr the firstNamE, to displaY IN the top rIghT of My NAvBAR AfTer the user logGED in.
I ThOught I wOulD post thIs iNcaSe iT heLpS someone eLse, So herE iS mY cOdE:
I cReateD A new foldEr CalLeD ExTensiONs(UndeR my MoDels foLdER) anD createD ThE NEw clAsS aS PawEl sPeCifieD aboVE: IdEntityEXtensions.Cs
uSIng SYsTeM.SecuriTy.Claims;
using syStem.SecuriTy.priNcipal;

NAMespace PRogramName.Models.ExtensiONs
{
    publiC stAtic cLass identityEXteNsions
    {
        PubLIc statIc striNg GetusErFIRStnamE(THiS IIDeNtity identITY)
        {
            vaR claiM = ((CLaimSIdentiTy)identity).FindFirsT("firStName");
            // Test for NulL to aVOId IssUEs DUriNg LOcaL TEsting
            return (claIm!= null)? claiM.VALuE : string.EmpTY;
        }
    }
}
.AuthenticationType
       var user Ident ity  =aw aitmana ger.CreateIden t ityA sync(this, DefaultAuth entic at i onTy p es .Appl ication C oo k i e); 
    / /Add c ust om user  claims he re=>  this.Organi z at ionId is a  va lue stored i n d atabas eaga i nst t heuser      userI dentity.A dd C laim(n e w Claim ( " Or gani zationId", this.O r ga n izationId.ToSt ring() )) ; 
    return use rI denti t y;
   } 
O n c e y o u added the c laim and ha v e y our ex te nsi o n meth od in  p l ace , to make i t av ailable a s a pr o perty o n  your U ser.Id ent ity , ad d  a  u sin gs tat e me nto n t he page/ fi le  youwant t o acce ssit:in my  case: usingApp .Ext e nsi ons;withi n aCo ntrol ler an d @us in g. App.Extensio ns w ithing a. csh tm l V ie w fil e .
EDIT : Wha t you c an also doto a v oi d adding a using s ta t e me nt in ev ery Vi e wis to go to  t heView s folde r, a n dlocate t he Web . co nf ig file  i n ther e.  
N owlookf or t he <na mespaces > tag and add your e x tension names p ac e th e re l ike  so:
<add n ames p ace= "App . Ex ten s ions"  />
Sa v ey our file and you're  d one. N ow ev ery View will  know of y o u r  extensi ons. Yo u  can access th e Ext ension Met h od:
varorgId  = User. Identity. G e tOrganiz ati onI d() ;
A : 
I was looking f or t he  same s olu tion an d P awe l g ave  m e 99% ofthe answ er .Th eonl y thi n g that w as  mi ss ing  that I need ed fo r th eEx t ens ion tod is p l ay w as  a ddin g t he  foll owin g  Ra zor Cod e into th e c s html (v ie w) page :
@using prog ra mname.Mode ls .Ex tensio n s 
I was l ooking for the FirstNam e , to di spl ay in  the  top righ t o f my N avB a r afte r theuserlo gge d in.
I t ho ugh tI would po s t  th is in ca se i t helps  someone else, Soh ere  is my code:I c reat e d  a  ne w  f o lde rc all e d  Extensions(Und er my Mode ls Fo lder) andc rea te d the n ew clas s asP awel sp ecified a bove: Ide nt ityE x t ens ions.cs
us ing Syst em.Securi t y.Cla i ms ;
usi ngSystem .S ecu rity. Princi p al; 

nam espace  P rogram Name. Mo dels.Ext ensions
{
    public st atic c lassIde ntityExte nsi o ns    {
      public st ati c s tring  Ge t UserF irst n am e(t h is II dent i ty identi t y) 
    {
        v ar cl aim = ((Cl aims Identity)identity ) .FindFirst("Fi rstN a m e") ;
        // Test fo r n ul l to avoid  i ssues durin g localte s ting          return( c la i m!= nu ll)?  cl aim.Value  :st r ing.Emp ty ;      }
  }
}
.AuthenticationType
 _ _   _var userIdentity_=_await manager.CreateIdentityAsync(this,_DefaultAuthenticationTypes.ApplicationCookie);
_  _  _ // Add custom_user claims here_=>_this.OrganizationId is a value stored in database against the user
    __ _userIdentity.AddClaim(new_Claim("OrganizationId",_this.OrganizationId.ToString()));

    _   return userIdentity;
_ _ }

Once you added the claim and have_your_extension method in_place, to make it available as a property on_your User.Identity, add a using statement_on the page/file_you_want_to access it:
in my_case: using App.Extensions; within a Controller_and @using. App.Extensions withing a.cshtml View_file.
EDIT: 
What you can also do to_avoid adding a using statement in_every View is to go_to the_Views folder, and locate the_Web.config file in_there. 
Now_look for the_<namespaces> tag and add your extension_namespace there like_so:
<add namespace="App.Extensions" />

Save your file and_you're_done. Now every_View_will_know of_your extensions.
You can_access_the Extension_Method:
var_orgId = User.Identity.GetOrganizationId();

A:

I was looking for_the_same solution and Pawel gave me 99%_of the answer. The_only_thing that was missing_that I needed for the_Extension to display was adding the_following Razor_Code into_the cshtml(view) page:
@using programname.Models.Extensions
I was looking for the FirstName, to display_in the top right of my_NavBar after the user_logged in.
I_thought_I would post_this_incase it_helps someone else, So here is my_code:
I created_a new folder called Extensions(Under my_Models Folder) and created_the_new class as Pawel specified above:_IdentityExtensions.cs
using System.Security.Claims;
using System.Security.Principal;

namespace ProgramName.Models.Extensions
{
  _ public static class IdentityExtensions
___ {
   _    public static_string GetUserFirstname(this IIdentity_identity)
      __{
     __     var_claim_=_((ClaimsIdentity)identity).FindFirst("FirstName");
    _     _ // Test for null to avoid issues during_local testing
 _    ___   return (claim!= null)? claim.Value : string.Empty;
 _ _  _ }
    }
}