Add group memberships to oidc id_token endpoint response
What does this MR do?
Oidc clients which are not able to load the /userinfo endpoint are not be able to manage access based on group membership.
To enable this group memberships have been added to the id_token endpoint. This removes the need to use middleware such as dex for applications like ArgoCD, AKHQ, ... . Further it reduces the need for an extra polling of userinfo and should lead to a reduction of performance needs
Fixes #29053
Screenshots or Screencasts (strongly suggested)
before:
{
"iss": "http://127.0.0.1:3000",
"sub": "1",
"aud": "c51abe1c1e5a32fd44694e7e3feb7f49529fc36a08bc6af403f00e53a61df055",
"exp": 1629192464,
"iat": 1629192344,
"auth_time": 1629182602,
"sub_legacy": "04345998080ec441c946fb08cc58942bfddaef9fa7c4430c5e03517643ec3432",
"email": "admin@example.com",
"email_verified": true
}
now:
{
"iss": "http://127.0.0.1:3000",
"sub": "1",
"aud": "c51abe1c1e5a32fd44694e7e3feb7f49529fc36a08bc6af403f00e53a61df055",
"exp": 1629192464,
"iat": 1629192344,
"auth_time": 1629182602,
"sub_legacy": "04345998080ec441c946fb08cc58942bfddaef9fa7c4430c5e03517643ec3432",
"email": "admin@example.com",
"email_verified": true,
"groups": [
"gitlab-org",
"gnuwget",
"Commit451",
"jashkenas",
"flightjs",
"twitter",
"h5bp",
"gitlab-instance-bcfa3364"
]
}
How to setup and validate locally (strongly suggested)
- Add application with
openid
scope - Setup OIDC flow using the application with a testing application. I have used https://github.com/BeryJu/oidc-test-client ( If you use this a customization of the requested scopes is necessary )
- Do the workflow
- Inspecht return values of IDTokenClaims
Does this MR meet the acceptance criteria?
Conformity
-
I have included changelog trailers, or none are needed. (Does this MR need a changelog?) -
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) -
I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?) -
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides. -
This change is backwards compatible across updates, or this does not apply.
Availability and Testing
If the user is member of a very large number of groups it could effect performance, but hard to tell if the need to no longer send an individual request to /userinfo mitigate this.
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) -
I have tested this MR in all supported browsers, or it's not needed. -
I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
Security
Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team