我有一个系统,通过网页api登录到本地wpf应用程序。
AuthenticationContext authContext = new AuthenticationContext(string.Format("https://login.windows.net/{0}", authority));
AuthenticationResult tokenAuthResult = authContext.AcquireTokenAsync(resource, clientId, new Uri(redirectUri), new PlatformParameters(PromptBehavior.Auto)).Result;
if (tokenAuthResult == null) return;
Credentials.RestCredentials = new TokenCredentials(tokenAuthResult.AccessToken);
Credentials.UserName = string.Concat(tokenAuthResult.UserInfo.GivenName, " ", tokenAuthResult.UserInfo.FamilyName);这一切都很完美,返回令牌等等。用户都在ADAL中,并有与他们相关的组(这些都是O365用户)。我希望能够查询登录的用户关联组是什么。我需要使用Graph发出一个新的调用吗?我是否使用返回的令牌?我有点迷路了。预先谢谢斯科特
发布于 2018-04-09 18:29:40
一个简单的方法是进入Azure中的应用程序注册,单击Manifest,并修改groupMembershipClaims属性:
"groupMembershipClaims": "SecurityGroup",这将导致包含用户组Id的Id令牌。它确实有一个限制,但只能包含一定数量的组,在这种情况下,您必须从Graph获得它们。
下面是在这种情况下需要调用的端点:https://msdn.microsoft.com/en-us/library/azure/ad/graph/api/functions-and-actions#getMemberGroups。
发布于 2018-04-25 09:59:20
为了添加到@juunas的答案,下面的示例活动目录-dotnet-webapp-groupclaims详细解释了一些事情。
特别是,步骤3:将应用程序配置为接收组索赔解释了清单中的应用程序配置。
还请参阅与https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-token-and-claims#claims-in-idtokens中的组相关的声明
https://stackoverflow.com/questions/49739216
复制相似问题