IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

adding ScopeClaim in new Resource-based Configuration

Open raigol opened this issue 9 years ago • 3 comments

How to add ScopeClaim in new Resource-based Configuration? I have read the blog post https://leastprivilege.com/2016/12/01/new-in-identityserver4-resource-based-configuration/ but don't fully understand. My old code was

        public static IEnumerable<Scope> GetScopes()
        {
            return new List<Scope>
            {
                StandardScopes.OpenId,
                StandardScopes.Profile,
                StandardScopes.Email,
                StandardScopes.OfflineAccess,

                new Scope
                {
                    Name = "myApi",
                    DisplayName = "myApi access",
                    Description = "myApi",
                        Claims = new List<ScopeClaim>
                        {
                            new ScopeClaim("companyCode", alwaysInclude: true)                            
                        }
                }
            };
        } 

but in the new model where and how to put companyCode? I have tried creating customProfile, but when looking into token with jwt.io it is not there.

raigol avatar Jan 12 '17 14:01 raigol

new ApiResource("myApi", "My Api")
{
    UserClaims = { "companyCode" }
},

brockallen avatar Jan 12 '17 15:01 brockallen

Thank you.

raigol avatar Jan 12 '17 15:01 raigol

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 15 '20 04:01 lock[bot]