-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update GitLab IDP to support OIDC #19997
Conversation
/hold
|
cc @alikhajeh1 |
// The ability to authenticate using GitLab, and read-only access to the user's profile information and group memberships | ||
gitlabOIDCScope = "openid" | ||
|
||
// An opaque token that uniquely identifies the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update this string to match new docs once https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19784/diffs merges.
I'd really like to retain a way to use the old cose, should an upgrade break with the openid code |
@simo5 so I was unable to make any sort of OIDC to OAuth2 fallback work (the OAuth scopes are different so it would require some crazy hack to try to make that work and I am pretty sure it is not possible in general). See what you think of the current approach of Currently the OAuth2 code works and the OIDC codes errors (as expected):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only a nit, but I'll leave to you whether to change it or not
/lgtm
// https://gitlab.com/help/integration/openid_connect_provider.md | ||
// Uses GitLab OIDC, requires GitLab 11.1.0 or higher | ||
// Earlier versions do not work: https://gitlab.com/gitlab-org/gitlab-ce/issues/47791#note_81269161 | ||
gitlabAuthorizePath = "/oauth/authorize" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a good reason to prepend all these module variables with "gitlab" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Matches the existing code and the other provider integrations.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enj, simo5 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This change updates the GitLab IDP integration to support OpenID Connect (while retaining support for OAuth2). This has the benefit of using a standard that was meant for authentication. In a future release this will allow us to remove the GitLab specific code from our integration. The GitLab OIDC provider reuses the standard OIDC code with a GitLab specific configuration. This change is fully backwards compatible as the identity/user objects are unchanged. It is not possible to detect if OIDC or OAuth2 should be used when GitLab is configured. Thus the configuration of the IDP has a new field called legacy which determines if OAuth2 or OIDC should be used. If true, OAuth2 is used and if false, OIDC is used. If the value is unspecified and the URL's host is gitlab.com, OIDC is used. Otherwise, OAuth2 is used. In a future release, unspecified will default to using OIDC. Eventually this flag will be removed and only OIDC will be used. To safely use OIDC, a very recent version of GitLab is required: version 11.1.0 or later. Attempting to use OIDC with an earlier version will fail at login time. No data corruption will occur. From the perspective of the end user, nothing changes. A positive side effect of using OIDC is that it allows us to use the openid scope instead of the api scope. This means that OpenShift only gets limited read access to perform authentication instead of full read and write access to the user's GitLab account. The user may have to reauthenticate OpenShift's OAuth client on first login. In the future OIDC will make it easy to pull group membership information from GitLab (the userinfo endpoint already include a groups claim, we simply need to add code in OpenShift that uses it). Trello: https://trello.com/c/DXntmEOV Signed-off-by: Monis Khan <mkhan@redhat.com>
New changes are detected. LGTM label has been removed. |
Changes were just me updating the git commit message. Retagged. Confirmed API with Jordan offline. I will remove the hold on this once |
/retest |
1 similar comment
/retest |
/hold cancel OIDC code works with |
/retest |
3 similar comments
/retest |
/retest |
/retest |
@enj: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Update GitLab IDP to support OIDC
This change updates the GitLab IDP integration to support OpenID
Connect (while retaining support for OAuth2). This has the benefit
of using a standard that was meant for authentication. In a future
release this will allow us to remove the GitLab specific code from
our integration. The GitLab OIDC provider reuses the standard OIDC
code with a GitLab specific configuration. This change is fully
backwards compatible as the identity/user objects are unchanged.
It is not possible to detect if OIDC or OAuth2 should be used when
GitLab is configured. Thus the configuration of the IDP has a new
field called legacy which determines if OAuth2 or OIDC should be
used. If true, OAuth2 is used and if false, OIDC is used. If the
value is unspecified and the URL's host is gitlab.com, OIDC is used.
Otherwise, OAuth2 is used. In a future release, unspecified will
default to using OIDC. Eventually this flag will be removed and
only OIDC will be used. To safely use OIDC, a very recent version
of GitLab is required: version 11.1.0 or later. Attempting to use
OIDC with an earlier version will fail at login time. No data
corruption will occur.
From the perspective of the end user, nothing changes. A positive
side effect of using OIDC is that it allows us to use the openid
scope instead of the api scope. This means that OpenShift only gets
limited read access to perform authentication instead of full read
and write access to the user's GitLab account. The user may have to
reauthenticate OpenShift's OAuth client on first login.
In the future OIDC will make it easy to pull group membership
information from GitLab (the userinfo endpoint already include a
groups claim, we simply need to add code in OpenShift that uses it).
Trello: https://trello.com/c/DXntmEOV
Signed-off-by: Monis Khan mkhan@redhat.com
Fixes #19937
Fixes #17954
Supersedes #19961
/assign @simo5 @liggitt
@openshift/sig-security