2017-04-13 96 views
0

我试图从Azure的AD获取用户群体。 我得到一个令牌代码的这些简单的线条:Azure的AD JWT认证 - 索赔缺少

   if (this.user == null) 
        user = await AuthenticationManager.DefaultManager.CurrentClient.LoginAsync(this, MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory); 
       if (user != null) 
       { 
        System.Diagnostics.Debug.WriteLine("Token = " + user.MobileServiceAuthenticationToken); 
       } 

当我粘贴标记在JWT调试器目前该网站上: https://jwt.io/我得到一些信息(stable_sid,SID,子,IDP, ver,iss,aud,exp,nbf)但我似乎无法得到团体声称。

我Azured AD加入所需的权限来读取微软图形和Azure的Active Directory组,但它并没有改变在任何标记。

我缺少的是让用户群体?

预先感谢您。

编辑:评论员指出,我忘了提及我修改了清单“groupMembershipClaims”:“SecurityGroup”,我也试过“全部”,但仍然没有要求。

+0

http://stackoverflow.com/a/43258621/1658906请问这帮助? – juunas

+0

感谢您的关注,我忘记提及我修改了清单,但它仍然没有给我预期的主张。 –

回答

1

好了,但是实际上这里没有问题。

我们应该做的存取权限的用户群体是使用身份验证令牌,以便使对微软图形API,那么这将给我们访问组和用户的租户电话。

https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-graph-api-quickstart

+0

要做到这一点的最佳地点在哪里,我们需要多长时间注入一次这些索赔信息? – twilliams

+0

@twilliams for ClientId/Client Secret(Jwt)A'uth然后JwtBearerOptions.Events.OnTokenValidated'。对于用户名/密码auth(Oauth),然后是“OpenIdConnectOptions.Events.OnAuthorizationCodeReceived”。 –