简体   繁体   中英

How to access and filter groups in JWT token using Azure AD?

net core application. I am returning JWT token which returns all the groups. I have below configuration in manifest.

"groupMembershipClaims": "SecurityGroup",
    "optionalClaims": {
        "idToken": [],
        "accessToken": [
            {
                "name": "groups",
                "source": null,
                "essential": false,
                "additionalProperties": []
            }
        ]
    },

Currently users has 100 or 200 groups. So I want to return groups via graph api. Along with that I want to return only groups whose name starts with AP. May I know is this possible? Any help in this regard appreciated. Thanks

Currently not possible. If users have more than 200 groups, they won't be in the token. In those cases you have to query for the group memberships via Graph API.

If you only have few groups that you care about, you can query for the members of those groups and see if the user is in them. Depends a bit on the data if it is faster to get the user's groups or to get the members of the groups you care about.

You can also assign users/groups to roles in your application, if that is the purpose of these checks.

You can configure the associated enterprise app registration to filter groups that will be included in the claim. Group Filtering

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM