debian-mirror-gitlab/doc/integration/openid_connect_provider.md

51 lines
2.8 KiB
Markdown
Raw Normal View History

2017-08-17 22:00:37 +05:30
# GitLab as OpenID Connect identity provider
This document is about using GitLab as an OpenID Connect identity provider
to sign in to other services.
## Introduction to OpenID Connect
2019-09-30 21:07:59 +05:30
[OpenID Connect](https://openid.net/connect/) \(OIDC) is a simple identity layer on top of the
2017-08-17 22:00:37 +05:30
OAuth 2.0 protocol. It allows clients to verify the identity of the end-user
based on the authentication performed by GitLab, as well as to obtain
basic profile information about the end-user in an interoperable and
2018-11-08 19:23:39 +05:30
REST-like manner. OIDC performs many of the same tasks as OpenID 2.0,
2017-08-17 22:00:37 +05:30
but does so in a way that is API-friendly, and usable by native and
mobile applications.
2019-12-21 20:55:43 +05:30
On the client side, you can use [OmniAuth::OpenIDConnect](https://github.com/jjbohn/omniauth-openid-connect/) for Rails
2019-09-30 21:07:59 +05:30
applications, or any of the other available [client implementations](https://openid.net/developers/libraries/#connect).
2017-08-17 22:00:37 +05:30
GitLab's implementation uses the [doorkeeper-openid_connect] gem, refer
to its README for more details about which parts of the specifications
are supported.
## Enabling OpenID Connect for OAuth applications
Refer to the [OAuth guide] for basic information on how to set up OAuth
2018-11-08 19:23:39 +05:30
applications in GitLab. To enable OIDC for an application, all you have to do
2017-08-17 22:00:37 +05:30
is select the `openid` scope in the application settings.
2018-11-08 19:23:39 +05:30
## Shared information
2017-08-17 22:00:37 +05:30
Currently the following user information is shared with clients:
| Claim | Type | Description |
|:-----------------|:----------|:------------|
2018-11-08 19:23:39 +05:30
| `sub` | `string` | The ID of the user
| `sub_legacy` | `string` | An opaque token that uniquely identifies the user<br><br>**Deprecation notice:** this token isn't stable because it's tied to the Rails secret key base, and is provided only for migration to the new stable `sub` value available from GitLab 11.1
2017-08-17 22:00:37 +05:30
| `auth_time` | `integer` | The timestamp for the user's last authentication
| `name` | `string` | The user's full name
| `nickname` | `string` | The user's GitLab username
| `email` | `string` | The user's public email address
| `email_verified` | `boolean` | Whether the user's public email address was verified
| `website` | `string` | URL for the user's website
| `profile` | `string` | URL for the user's GitLab profile
| `picture` | `string` | URL for the user's GitLab avatar
2018-03-27 19:54:05 +05:30
| `groups` | `array` | Names of the groups the user is a member of
2017-08-17 22:00:37 +05:30
2018-11-08 19:23:39 +05:30
Only the `sub` and `sub_legacy` claims are included in the ID token, all other claims are available from the `/oauth/userinfo` endpoint used by OIDC clients.
2017-08-17 22:00:37 +05:30
[doorkeeper-openid_connect]: https://github.com/doorkeeper-gem/doorkeeper-openid_connect "Doorkeeper::OpenidConnect website"
[OAuth guide]: oauth_provider.md "GitLab as OAuth2 authentication service provider"