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

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

Open
hargrave81 opened this issue Jun 7, 2017 · 1 comment
Labels

Comments

@hargrave81
Copy link

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?

@brockallen
Copy link
Member

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.

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

No branches or pull requests

2 participants