I am using the carrier token authorization in my ASP.NET Web API project and I have added some custom claims in it, such as:
Var authType = AuthConfig.OAuthOptions.AuthenticationType; Var identity = new claim object (authType); Identity.AddClaim (new claim type (name, vm.Username)); // Custom Claim Identity.Adclaim (New Claim ("Company ID", Profile CompanId.ToString ());
Is there any way I can access the value of this additional claim in the controller without the extra database visit?
Of course, inside your protected controller, you do the following:
Claim Principle = Principal GatorQuest Contact Principal principal of claims; Var customClaimValue = Principal.Claim. Where (C => c.Type == "Company ID"). Solo (). Values;