himmelblau-idm / himmelblau

Azure Entra ID Authentication, with PAM and NSS modules.
GNU General Public License v3.0
25 stars 3 forks source link

Group memberships are missing #132

Closed dmulder closed 2 months ago

dmulder commented 2 months ago

Sometime during the Broker work, group memberships appear to have stopped working. Part of the issue is that we are requesting the wrong resource, but after fixing this, there is still an error during the membership request: ERROR 🚨 [error]: Error encountered while fetching user groups: {"error":{"code":"Authorization_RequestDenied","message":"Insufficient privileges to complete the operation.","innerError":{"date":"2024-05-16T21:39:25","request-id":"eaaf6ba4-59f5-4871-9d79-285e48fc4486","client-request-id":"eaaf6ba4-59f5-4871-9d79-285e48fc4486"}}}

When I inspect the access token used to make the request, the problem is obvious:

{
  "typ": "JWT",
  "nonce": "XXX",
  "alg": "RS256",
  "x5t": "XXX",
  "kid": "XXX"
}.{
  "aud": "00000003-0000-0000-c000-000000000000",
  "iss": "https://sts.windows.net/68355c6e-0a63-442d-a2ec-71cc6bb3e24b/",
  "iat": 1715895264,
  "nbf": 1715895264,
  "exp": 1715900169,
  "acct": 0,
  "acr": "1",
  "aio": "XXX",
  "amr": [
    "rsa",
    "mfa"
  ],
  "app_displayname": "Windows Sign In",
  "appid": "38aa3b87-a06d-4817-b275-7a316988d93b",
  "appidacr": "0",
  "deviceid": "d83d26d7-1b11-482b-90fa-6419d7054683",
  "idtyp": "user",
  "ipaddr": "69.163.66.79",
  "name": "Tux",
  "oid": "90d675df-bfa8-4d78-8f8f-7b1043181bb6",
  "platf": "8",
  "puid": "10032003083728EB",
  "pwd_url": "https://portal.microsoftonline.com/ChangePassword.aspx",
  "rh": "0.XXX.",
  "scp": "user_impersonation",
  "sub": "MnzaCC6hetHPAf98N7tc1iinmtJMBLzogoz_pvF9Zts",
  "tenant_region_scope": "NA",
  "tid": "68355c6e-0a63-442d-a2ec-71cc6bb3e24b",
  "unique_name": "tux@10fp7z.onmicrosoft.com",
  "upn": "tux@10fp7z.onmicrosoft.com",
  "uti": "i-hMDQpxD0SmEvWQ6mHAAA",
  "ver": "1.0",
  "wids": [
    "b79fbf4d-3ef9-4689-8143-76b194e85509"
  ],
  "xms_tcdt": 1694157204
}.[Signature]

The requested scope was not assigned! Looking at Dirk-jan Mollema implementation, he never supplies a scope in the way that I have in the prt exchange request. It looks like I've done something wrong here in MSAL. The question is, if that's the wrong place to request the scope, where is the correct place (there doesn't seem to be one)???