Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust scopes to be in line with the Microsoft Identity Platform v2. #2047

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

schuhu
Copy link

@schuhu schuhu commented Mar 16, 2021

Overview

This PR adds the openid scope necessary for the Microsoft Identity Platform v2 as well as changes the user and group scopes to the ones now supported on the Microsoft graph API.
This PR was created together with Microsoft backend engineers and fixes #1855

What this PR does / why we need it

The current Microsoft connector just works. But if you enabled features like 2fa on your Microsoft Azure AD Application this is not enforced, because the scopes used trigger the Azure App in a different way than intended.

So, to be able to use 2fa on a Microsoft Azure AD App, you need those changes.

Special notes for your reviewer

I tested this change locally with group sync and refresh token. Same behaviour as before, except that policies like 2fa applied to the Azure AD App now are enforced by Microsoft.

Does this PR introduce a user-facing change?

NONE

Signed-off-by: Christian Brauchli <[email protected]>
@schuhu
Copy link
Author

schuhu commented Mar 30, 2021

dear @nabokihms

can I support you for the review? Or is there anything missing from my side?

thanks,

christian

@nabokihms
Copy link
Member

@schuhu Hello, thanks for submitting the PR. According to the description, it might be a good improvement. Unfortunately, we have no integration tests for this connector, so it will take us some time to review the changes.

@schuhu
Copy link
Author

schuhu commented Mar 30, 2021

@schuhu Hello, thanks for submitting the PR. According to the description, it might be a good improvement. Unfortunately, we have no integration tests for this connector, so it will take us some time to review the changes.

no problem, just tell me how I can assist.

@wiegandf
Copy link

wiegandf commented Apr 8, 2021

Is Directory.Read.All still required or would we need to adapt https://github.com/dexidp/website/blob/main/content/docs/connectors/microsoft.md?

I am wondering because with scopeDefault = "https://graph.microsoft.com/.default", dex was still trying to get the Directory.Read.All scope (added to my application but not granted consent yet) and it failed for me. When I added user.read scope instead of scopeDefault, everything seems to work fine. But maybe I am overseeing an issue here?

Isn't User.Read enough for this call:

reqURL := c.graphURL + "/v1.0/me/getMemberGroups"

See the API documentation: https://docs.microsoft.com/de-de/graph/api/user-getmembergroups?view=graph-rest-1.0&tabs=http

@schuhu
Copy link
Author

schuhu commented Apr 9, 2021

According to Microsoft, you still need to give the app the Directory.Read.All permission. Unfortunately I don't know if this is only necessary if you sync groups or if this is a basic requirement.

@wiegandf
Copy link

wiegandf commented Apr 9, 2021

I am positive that it's not required for this call https://docs.microsoft.com/de-de/graph/api/user-getmembergroups, as dex is using delegated permissions only (that's what's also documented in https://github.com/dexidp/website/blob/main/content/docs/connectors/microsoft.md#caveats).

With the default scopes it should be fine and we would just need to change the documentation which scopes are really required in the application.

@schuhu
Copy link
Author

schuhu commented Apr 12, 2021

Unfortunately, I'm no Azure AD admin and lack the permissions in our company to test this. Would you mind doing that?

@schuhu
Copy link
Author

schuhu commented Apr 26, 2021

@wiegandf do you expect this to be merged sometime soon?

@wiegandf
Copy link

Unfortunately, I also have no means to test this. And I am also not one of the dex maintainers, so I can't merge it.

@brokenjacobs
Copy link

Any status on this PR? Microsoft is deprecating support for their older identity platform calls this year.

@schuhu
Copy link
Author

schuhu commented Jun 15, 2022

Any status on this PR? Microsoft is deprecating support for their older identity platform calls this year.

tbh, because dex did not yet merge it, we run our own fork with this connector for over a year now in production.

we use dex to bridge the gap between istio/oauth2-proxy and aad for dozens of apps, hundreds of users and, thousands of logins a day.

@netsplit
Copy link

@nabokihms can we somehow bring this forward?

@nabokihms nabokihms self-requested a review June 24, 2022 18:25
@nabokihms
Copy link
Member

I think I can take a look on it. Since I have no access to Microsoft IdP v2, it can take some time.

@pdf
Copy link

pdf commented Jul 18, 2022

The PR is a bit messy (merge commits and 6407711 should not be included here), but it would also solve #2442. I'll try to find some time to test against our AzureAD tenant this week if that would be useful @nabokihms ?

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

Successfully merging this pull request may close these issues.

Add openid scope to request for Microsoft Azure connector
6 participants