FAQ Database Discussion Community


Retrieve information from Bearer Token

asp.net-web-api,claims-based-identity,claims,bearer-token
I have an MVC website that is calling a WebAPI in another project. The WebAPI uses OWIN and implements OAuth security. I will be using a Bearer Token to communicate between the MVC and WebAPI applications. My website requires the user to be in AD, which I am checking in...

ASP.NET Identity and Claim-based

c#,asp.net-mvc,asp.net-identity,claims-based-identity,claims
How to use claims? For example, I want to set access to each page (resource) for each user. I understand, I can do it using roles, but as I understand, claim-based is more effectively. But when I try to create a claim, I see the following method: userIdentity.AddClaim(new Claim(ClaimTypes.Role, "test...

Is System.IdentityModel.Policy.IAuthorizationPolicy obsolete?

c#,wcf,wif,claims-based-identity,claims
According to this msdn article, the interface IAuthorizationPolicy is the way to go to inject custom authorization logic / custom claims when using wcf. https://msdn.microsoft.com/en-us/library/ms729851(v=vs.110).aspx However it seems like some of the used classes in this interface are "almost obsolete" according to http://msdn.microsoft.com/en-us/library/system.identitymodel.claims%28v=vs.110%29.aspx The System.IdentityModel.Claims namespace contains classes that implement...

Custom role provider with Claims

asp.net,model-view-controller,roles,claims
I have User table in my database where i keep user's role (master admin, admin, developer). i want to authorize some controllers so only master admin can have access. namespace TicketSystem.Controllers { public class UserCredentials : ClaimsPrincipal, IIdentity, IPrincipal { public IIdentity Identity { get; private set; } public int...

Is it possible to access the properties of ApplicationUser in MVC without query?

c#,asp.net,asp.net-mvc,claims-based-identity,claims
I'm creating an ASP.NET MVC 5 app, and I'm using the default individual authentication, which in turn uses ASP.NET Identity. I extended the default ApplicationUser class by adding the following properties: public class ApplicationUser : IdentityUser { public string FirstName { get; set; } public string LastName { get; set;...

can't remove user claim in asp Identity

asp.net,asp.net-web-api,asp.net-identity,claims
i Try to update user claims in my service and at the first i should remove claims like this: var userClaimCollection = this.AppUserManager.GetClaims(user.Id); var toRemove = new List<Claim>(); foreach (var claim in userClaimCollection) { if (claim.Type == group_role) { toRemove.Add(claim); } } foreach(var t in toRemove) { Claim c =...