microsoftgraph / aspnetcore-connect-sample

[ARCHIVED] This ASP.NET Core MVC sample shows how to connect to Microsoft Graph using delegated permissions and the Azure AD v2.0 (MSAL) endpoint.
MIT License
123 stars 96 forks source link

Access user groups #11

Closed caclement closed 6 years ago

caclement commented 6 years ago

How could I get access to user groups and do some proper authorisation with this sample app ?

mark-szabo commented 6 years ago

Hi @caclement, Here's the documentation of the different types of groups in the Microsoft ecosystem: https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/groups-overview

Regarding authorization: You need to authenticate the users one by one, not by groups. After authentication you can check wether the user is in the group and you can do the authorization depending on this.

caclement commented 6 years ago

Thans for the link, is it possible to provide a code sample to fetch a user security groups ?

Also with a simple code sample for authorisation. I think this would be a more "real life" example as users are part of certain security groups and they can or cannot access to some ressource in the app.

mark-szabo commented 6 years ago

Hi @caclement, the purpose of this repo is to demonstrate how to connect to Microsoft Graph from ASP.NET Core. Adding an extra security group authorization step here would be confusing, but we added this to our list and when we will have the capacity we'll check where would this fit perfectly!

Thanks, Mark