Search code examples
asp.net-web-apiclaims-based-identitythinktecture-ident-servermembershiprebootthinktecture

Missing Claims and Identity Info with IdentityServer v3


I have IdentityServer with Membership Reboot and IdentityManager running on a remote server, I've used the Admin UI of IdentityManager to setup a user, and add roles & claims to said user.

I'm developing a WebApi/SPA project that will use the remote server for Auth. Using fiddler I can request a token from the IdentityManagner on the remote box and use this token to against the local WebApi where Authorization is required. If the token is valid the WebApi processes like normal, if the token is bogus I get a 401. Works great.

The problem is when I want additional information about the user none of the claims or identity information is coming across. I'm not sure if the problem is at the IdentityServer side, The WebApi side, or if I'm not doing something correctly when getting my token.


Solution

  • I didn't realize we needed put the claims in the Scope definition. Incase anyone else stumbles upon this I changed my scope to the following

       var scopes = new List<Scope>
        {
            new Scope
            {
                Enabled = true,
                Name = "publicApi",
                Description = "Access to our public API",
                Type = ScopeType.Resource,
                IncludeAllClaimsForUser = true, //I'll filter this down later
            }
        };
        scopes.AddRange(StandardScopes.All);
    
        return scopes;
    

    Further details can be found here