IdentityServer3.Samples icon indicating copy to clipboard operation
IdentityServer3.Samples copied to clipboard

ID_Token contains the claim but the Post Example doesn't parse the claim

Open hargrave81 opened this issue 8 years ago • 1 comments

I've been plugging away at this issue for a bit now. I have a claim that regardless of what scope I add the claim to, is not added to the list of claims for the logged in user using the MVC Form POST example project.

        var url = this.Request.GetOwinContext().Environment.GetIdentityServerBaseUrl() + "connect/authorize" +
            "?client_id=03fe9716-90d9-42bc-9d4a-136585e11e37" +
            "&response_type=id_token" +
            "&scope=openid email profile roles" +
            "&redirect_uri=" + this.Request.GetOwinContext().Environment.GetIdentityServerBaseUrl()  + "account" +
            "&response_mode=form_post" +
            "&state=" + state +
            "&nonce=" + nonce;

The server sees the need to include the claims (by default they were part of the roles scope, but I've tried other scopes like email). My claim name is superadmin. The JWT when you look at what is posted back to the MVC app contains the superadmin claim. It however isn't parsed.

public class AuthOwin : AuthorizeAttribute { protected override bool AuthorizeCore(HttpContextBase httpContext) {
var e = httpContext.GetOwinContext().Environment.GetIdentityServerFullLoginAsync().Result; } }

e.Claims does not contain the super admin claim. It has email, given_name, etc. But not my custom claim.

Suggestions?

hargrave81 avatar Jun 07 '17 11:06 hargrave81

I'm not following exactly, but if you want a specific claim type then you need to add it to one of the scope definitions being requested.

brockallen avatar Jun 16 '17 09:06 brockallen