IdentityManager / IdentityManager.AspNetIdentity

ASP.NET Identity support for Thinktecture IdentityManager
Apache License 2.0
60 stars 51 forks source link

Authentication Problem (ClaimType for "role") #32

Closed DarioN1 closed 8 years ago

DarioN1 commented 8 years ago

Hello, I notice that when I create a new Role and I assign it to a specific user, by default the application create the Claim as: "role" -- "RoleName".

This make me a bit confused...

I know that the command:

manager.IsInRole(dn1.Id, "ADMINISTRATOR")

Checks for a claim with Schema: http://schemas.microsoft.com/ws/2008/06/identity/claims/role

So why AspIdentityManager is putting "role" instead of "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" as claim type?

Is there a specific reason? Hope I was clear...

Thanks to support

brockallen commented 8 years ago

Because "role" is the more modern claim type for roles, compared to the old WS-* style of using an XML namespace.

DarioN1 commented 8 years ago

Thanks Brock!

But now... How can I tell to my MVC application, to read "role" as ClaimType instead of "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" ClaimType for the authentication?

Which is the best practice ?

In this moment AspIdentityManager role section works with "role" claimtype, but my application tests "http://schemas.microsoft.com/ws/2008/06/identity/claims/role"...

I'm a bit confused... Thanks

brockallen commented 8 years ago

You use the "roleClaimType" parameter when creating the ClaimsIdentity, or configure the "roleClaimType" properties on the CookieMiddleware in Katana.