ritterim / stuntman

Library for impersonating users during development leveraging ASP.NET Identity.
https://rimdev.io/stuntman/
MIT License
294 stars 35 forks source link

Adding claims #101

Closed whoiskevinrich closed 8 years ago

whoiskevinrich commented 8 years ago

I'm new to claims in general, but believe in TDD. I was wondering how I can give a StuntmanUser a claim for multiple roles? Is there a list of supported claims?

kendaleiv commented 8 years ago

You can specify any claim you'd like. Stuntman doesn't have the concept of roles baked in. But, if your roles are managed by claims, you could add the role claim for each role you wish to apply to a StuntmanUser.

new StuntmanOptions()
    .AddUser(new StuntmanUser("user-1", "User 1")
        .AddClaim("given_name", "John")
        .AddClaim("family_name", "Doe")
        .AddClaim("role", "StandardUser")
        .AddClaim("role", "Administrator"));
kendaleiv commented 8 years ago

This may or may not be a useful claim for your use case: https://msdn.microsoft.com/en-us/library/system.security.claims.claimtypes.role(v=vs.110).aspx

whoiskevinrich commented 8 years ago

Great, that throws me in the right direction. Our intranet projects typically use Windows Authentication and Stuntman would certainly be an answer to an ongoing issue that we have. :)

On Tue, Feb 2, 2016 at 1:16 PM Ken Dale notifications@github.com wrote:

This may or may not be a useful claim for your use case: https://msdn.microsoft.com/en-us/library/system.security.claims.claimtypes.role(v=vs.110).aspx

— Reply to this email directly or view it on GitHub https://github.com/ritterim/stuntman/issues/101#issuecomment-178824830.