Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
169 views
in Technique[技术] by (71.8m points)

ms office - Adding an additional Windows Azure AD delegated permission to an existing grant

I've got an in-production Windows Azure AD App which authenticates users via OAuth2. Currently, it requests only one delegated permission - "Enable sign on and read users' profiles". I'm adding a new feature to our application which will make use of the Office 365 API(s), and this obviously requires additional delegated permissions to be requested by the App.

I've updated our App manifest, and new users who give consent to our App grant both the sign-in and the Office 365 delegated permissions, and the token endpoint response scope param is UserProfile.Read Mail.Read as expected. However, for existing users who gave consent to our App when it only requested the sign-in delegated permission, Windows Azure AD doesn't prompt them to grant the additional Office 365 delegated permission the next time they log in. For these users, the token endpoint response scope param still comes through as UserProfile.Read, i.e. the sign-in delegated permission only.

I know I can pass ?prompt=consent to https://login.microsoftonline.com/common/oauth2/authorize which will force a user to grant all requested delegated permissions, but that's a bit of a sledgehammer approach because it would ask everyone, every time, when all I want to do is catch these users where there's a difference between requested and granted delegated permissions. It wouldn't play well in the SSO experience I'm trying to maintain.

With Google OAuth, scopes are passed as query params in the authorisation request, and the user is prompted to grant consent for any scopes requested that haven't already been granted. For new users that would be all scopes, for existing users that would be the newly added scopes, and after that no additional consent would be required because all scopes would then have been granted - that's exactly what I'm trying to achieve with Windows Azure AD.

Is there some way enforce the delegated permissions configured in the App manifest as mandatory, i.e. sign-in will not complete without these delegated permissions having been granted?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The Azure folks are working on implementing passing scopes in each request. In the meantime, the guidance they've given is that you do not include prompt=consent with every request. Instead, if you get an Unauthorized error, then you fall back on re-requesting with prompt=consent.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...