2016-06-02 11:05:42 +05:30
|
|
|
# Auth0 OmniAuth Provider
|
|
|
|
|
|
|
|
To enable the Auth0 OmniAuth provider, you must create an Auth0 account, and an
|
|
|
|
application.
|
|
|
|
|
2019-02-15 15:39:39 +05:30
|
|
|
1. Sign in to the [Auth0 Console](https://auth0.com/auth/login). If you need to
|
2019-07-07 11:18:12 +05:30
|
|
|
create an account, you can do so at the same link.
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. Select "New App/API".
|
|
|
|
|
|
|
|
1. Provide the Application Name ('GitLab' works fine).
|
|
|
|
|
|
|
|
1. Once created, you should see the Quick Start options. Disregard them and
|
2019-07-07 11:18:12 +05:30
|
|
|
select 'Settings' above the Quick Start options.
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. At the top of the Settings screen, you should see your Domain, Client ID and
|
2019-07-07 11:18:12 +05:30
|
|
|
Client Secret. Take note of these as you'll need to put them in the
|
|
|
|
configuration file. For example:
|
2019-09-30 21:07:59 +05:30
|
|
|
- Domain: `test1234.auth0.com`
|
|
|
|
- Client ID: `t6X8L2465bNePWLOvt9yi41i`
|
|
|
|
- Client Secret: `KbveM3nqfjwCbrhaUy_gDu2dss8TIlHIdzlyf33pB7dEK5u_NyQdp65O_o02hXs2`
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. Fill in the Allowed Callback URLs:
|
2019-09-30 21:07:59 +05:30
|
|
|
- `http://YOUR_GITLAB_URL/users/auth/auth0/callback` (or)
|
|
|
|
- `https://YOUR_GITLAB_URL/users/auth/auth0/callback`
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. Fill in the Allowed Origins (CORS):
|
2019-09-30 21:07:59 +05:30
|
|
|
- `http://YOUR_GITLAB_URL` (or)
|
|
|
|
- `https://YOUR_GITLAB_URL`
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. On your GitLab server, open the configuration file.
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
For Omnibus package:
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2019-09-30 21:07:59 +05:30
|
|
|
sudo editor /etc/gitlab/gitlab.rb
|
|
|
|
```
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
For installations from source:
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2020-03-09 13:42:32 +05:30
|
|
|
```shell
|
2019-09-30 21:07:59 +05:30
|
|
|
cd /home/git/gitlab
|
|
|
|
sudo -u git -H editor config/gitlab.yml
|
|
|
|
```
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. See [Initial OmniAuth Configuration](omniauth.md#initial-omniauth-configuration)
|
2019-07-07 11:18:12 +05:30
|
|
|
for initial settings.
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. Add the provider configuration:
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
For Omnibus package:
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
```ruby
|
|
|
|
gitlab_rails['omniauth_providers'] = [
|
|
|
|
{
|
|
|
|
"name" => "auth0",
|
|
|
|
"args" => { client_id: 'YOUR_AUTH0_CLIENT_ID',
|
|
|
|
client_secret: 'YOUR_AUTH0_CLIENT_SECRET',
|
|
|
|
domain: 'YOUR_AUTH0_DOMAIN',
|
|
|
|
scope: 'openid profile email'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
For installations from source:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- { name: 'auth0',
|
|
|
|
args: {
|
|
|
|
client_id: 'YOUR_AUTH0_CLIENT_ID',
|
|
|
|
client_secret: 'YOUR_AUTH0_CLIENT_SECRET',
|
|
|
|
domain: 'YOUR_AUTH0_DOMAIN',
|
|
|
|
scope: 'openid profile email' }
|
|
|
|
}
|
|
|
|
```
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. Change `YOUR_AUTH0_CLIENT_ID` to the client ID from the Auth0 Console page
|
2019-07-07 11:18:12 +05:30
|
|
|
from step 5.
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
1. Change `YOUR_AUTH0_CLIENT_SECRET` to the client secret from the Auth0 Console
|
2019-07-07 11:18:12 +05:30
|
|
|
page from step 5.
|
2016-06-02 11:05:42 +05:30
|
|
|
|
2019-09-30 21:07:59 +05:30
|
|
|
1. [Reconfigure][] or [restart GitLab][] for the changes to take effect if you
|
|
|
|
installed GitLab via Omnibus or from source respectively.
|
2016-06-02 11:05:42 +05:30
|
|
|
|
|
|
|
On the sign in page there should now be an Auth0 icon below the regular sign in
|
|
|
|
form. Click the icon to begin the authentication process. Auth0 will ask the
|
|
|
|
user to sign in and authorize the GitLab application. If everything goes well
|
|
|
|
the user will be returned to GitLab and will be signed in.
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
[reconfigure]: ../administration/restart_gitlab.md#omnibus-gitlab-reconfigure
|
|
|
|
[restart GitLab]: ../administration/restart_gitlab.md#installations-from-source
|