I've got a C# .NET project setup using Entity Framework, MembershipReboot and IdentityServer3.
I'm looking at the database and I see a UserClaims
table. Inside this table I've added a few claims using the MembershipReboot AddClaim
method.
The claims from the UserClaims
table are somehow added to the ClaimsPrincipal
. I can see this when I send a request to my Controller
. In the controllers ActionResult
method I have the following couple lines of code:
var claimsPrincipal = User as ClaimsPrincipal;
if (claimsPrincipal != null)
{
var userClaims = claimsPrincipal.Claims;
In this example userClaims
will contain the claims from MembershipReboots UserClaims
table.
In a similar fashion I'd like to add some additional claims to the ClaimsPrincipal
without using the UserClaims table. The idea is that if a user is a member of a group then they will inherit claims which are associated with that group. I've created a separate table that I'm storing these group claims in - but I'm having trouble actually adding these claims to the ClaimsPrincipal
.
I've been looking at the SamAuthenticationService
in MembershipReboot however I'm not sure if I'm looking in the right place.
Would someone more familiar with MembershipReboot and IdentityServer be able to point me in the right direction?