Skip to content
This repository has been archived by the owner on Dec 14, 2017. It is now read-only.

IdentityServer.Admin data model does not allow specifying Claim value type #39

Open
brat000012001 opened this issue Jun 3, 2016 · 2 comments

Comments

@brat000012001
Copy link

brat000012001 commented Jun 3, 2016

Hi,

A question/suggestion about claim value types. Some resource providers expect the claim values to be integers, bools or strings. It seems that neither IdentityManager.EF nor IdentityServer.Admin.EF have support for claim value types (see IdentityServer3.Admin/source/Core/Core/Client/ClientClaimValue.cs , IdentityManager/source/Core/Core/ClaimValue.cs ). Is that something that you guys have thought of adding in a future?
Thx

@brat000012001 brat000012001 changed the title Ability to specify Claim value type IdentityServer.Admin data model does not allow specifying Claim value type Jun 3, 2016
@iBoonz
Copy link
Contributor

iBoonz commented Jun 4, 2016

I think that the .net claims and jwt token only support string types. That is the main reason we dont use int or bool.
@leastprivilege could you confirm? :)
ty

@brat000012001
Copy link
Author

brat000012001 commented Jun 5, 2016

@iBoonz: one of the constructor overloads of System.Security.Claims.Claim takes a claim value type. Since JWT is a JSON object, it supports JSON basic types. For example, the following code correctly serializes the claim "tenant_id" as integer:

class MyClaimsProvider : DefaultClaimsProvider
{
   public override async Task<IEnumerable<Claim>> GetAccessTokenClaimsAsync(...) {
       var claims = base.GetAccessTokenClaimsAsync(...);
       claims.Add(new Claim("tenant_id", "3", ClaimValueTypes.Integer);
       return claims;
   }
}

I searched through RFC 7519 but could not find anything related to the constraint you referred to. In fact, the spec says the opposite: "A claim value can be any JSON value". I am just going to assume that this is a missing feature, and given the lack of response the priority, if any, is low

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants