I've got IdentityServer3 running as a standalone identity server.
I have a separate MVC client that uses Cookies and OpenIdConnect for authentication. I'm trying to set up claims transformations amongst other things, and would like to reference the different claims types like so:
var givenName = id.FindFirst(Constants.ClaimTypes.GivenName);
var familyName = id.FindFirst(Constants.ClaimTypes.FamilyName);
var sub = id.FindFirst(Constants.ClaimTypes.Subject);
var roles = id.FindAll(Constants.ClaimTypes.Role);
On the IdentityServer3, I reference these using Thinktecture.IdentityServer.Core.Constants
however on my MVC client I don't think I should need to reference Thinktecture.IdentityServer3
just for these string constants? Is there a client library that is recommended to be used in this case? I've tried Thinktecture.IdentityModel
and some .NET references but none seem to replicate the ClaimTypes
in Thinktecture.IdentityServer.Core.Constants
. The best I've found is System.Security.Claims.ClaimTypes
but that seems to have several missing e.g. FamilyName
.
The first placed I looked was Thinktecture.IdentityModel
but was surprised these aren't there.
So what's the magic reference? Or is it appropriate to load Thinktecture.IdentityServer3
just for these strings?
Thanks
EDIT: So I've found Thinktecture.IdentityModel.Client
which contains a JwtClaimTypes
that seems to mirror ClaimTypes
. Why is this named with a Jwt prefix though?
IdentityModel
package can help you. UseIdentityModel.JwtClaimTypes.Subject
– Jobye