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

99 lines
4.1 KiB
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
2022-07-16 23:28:13 +05:30
stage: Manage
group: Authentication and Authorization
2022-11-25 23:54:43 +05:30
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
2021-01-29 00:20:46 +05:30
---
2021-11-18 22:05:49 +05:30
# Salesforce OmniAuth Provider **(FREE SELF)**
2019-07-31 22:56:46 +05:30
2022-11-25 23:54:43 +05:30
You can integrate your GitLab instance with [Salesforce](https://www.salesforce.com/) to enable users to sign in to your GitLab instance with their Salesforce account.
2019-07-31 22:56:46 +05:30
2019-09-04 21:01:54 +05:30
## Create a Salesforce Connected App
2019-07-31 22:56:46 +05:30
2019-09-04 21:01:54 +05:30
To enable Salesforce OmniAuth provider, you must use Salesforce's credentials for your GitLab instance.
2022-06-21 17:19:12 +05:30
To get the credentials (a pair of Client ID and Client Secret), you must [create a Connected App](https://help.salesforce.com/s/articleView?id=sf.connected_app_create.htm&type=5) on Salesforce.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
1. Sign in to [Salesforce](https://login.salesforce.com/).
2019-07-31 22:56:46 +05:30
2022-07-23 23:45:48 +05:30
1. In Setup, enter `App Manager` in the Quick Find box, select **App Manager**, then select **New Connected App**.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
1. Fill in the application details into the following fields:
- **Connected App Name** and **API Name**: Set to any value but consider something like `<Organization>'s GitLab`, `<Your Name>'s GitLab`, or something else that is descriptive.
- **Contact Email**: Enter the contact email for Salesforce to use when contacting you or your support team.
- **Description**: Description for the application.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
![Salesforce App Details](img/salesforce_app_details.png)
2022-07-23 23:45:48 +05:30
1. Select **API (Enable OAuth Settings)** and select **Enable OAuth Settings**.
2019-09-30 21:07:59 +05:30
1. Fill in the application details into the following fields:
- **Callback URL**: The callback URL of your GitLab installation. For example, `https://gitlab.example.com/users/auth/salesforce/callback`.
2020-11-24 15:15:51 +05:30
- **Selected OAuth Scopes**: Move `Access your basic information (id, profile, email, address, phone)` and `Allow access to your unique identifier (openid)` to the right column.
2019-09-30 21:07:59 +05:30
2020-04-22 19:07:51 +05:30
![Salesforce OAuth App Details](img/salesforce_oauth_app_details.png)
2019-07-31 22:56:46 +05:30
2022-07-23 23:45:48 +05:30
1. Select **Save**.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
1. On your GitLab server, open the configuration file.
2019-12-04 20:38:33 +05:30
For Omnibus package:
2019-09-30 21:07:59 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-09-30 21:07:59 +05:30
sudo editor /etc/gitlab/gitlab.rb
```
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
For installations from source:
2019-07-31 22:56:46 +05:30
2020-03-13 15:44:24 +05:30
```shell
2019-09-30 21:07:59 +05:30
cd /home/git/gitlab
sudo -u git -H editor config/gitlab.yml
```
2019-07-31 22:56:46 +05:30
2023-06-20 00:43:36 +05:30
1. Configure the [common settings](omniauth.md#configure-common-settings)
2023-04-23 21:23:45 +05:30
to add `salesforce` as a single sign-on provider. This enables Just-In-Time
account provisioning for users who do not have an existing GitLab account.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
1. Add the provider configuration:
2019-07-31 22:56:46 +05:30
2019-12-04 20:38:33 +05:30
For Omnibus package:
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
```ruby
gitlab_rails['omniauth_providers'] = [
{
2022-01-26 12:08:38 +05:30
name: "salesforce",
# label: "Provider name", # optional label for login button, defaults to "Salesforce"
app_id: "SALESFORCE_CLIENT_ID",
app_secret: "SALESFORCE_CLIENT_SECRET"
2019-09-30 21:07:59 +05:30
}
]
```
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
For installation from source:
2019-07-31 22:56:46 +05:30
2020-04-22 19:07:51 +05:30
```yaml
2019-09-30 21:07:59 +05:30
- { name: 'salesforce',
2022-01-26 12:08:38 +05:30
# label: 'Provider name', # optional label for login button, defaults to "Salesforce"
2019-09-30 21:07:59 +05:30
app_id: 'SALESFORCE_CLIENT_ID',
app_secret: 'SALESFORCE_CLIENT_SECRET'
2021-01-03 14:25:43 +05:30
}
2019-09-30 21:07:59 +05:30
```
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
1. Change `SALESFORCE_CLIENT_ID` to the Consumer Key from the Salesforce connected application page.
1. Change `SALESFORCE_CLIENT_SECRET` to the Consumer Secret from the Salesforce connected application page.
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
![Salesforce App Secret Details](img/salesforce_app_secret_details.png)
2019-07-31 22:56:46 +05:30
2019-09-30 21:07:59 +05:30
1. Save the configuration file.
2022-10-11 01:57:18 +05:30
1. For the changes to take effect:
- If you installed via Omnibus, [reconfigure GitLab](../administration/restart_gitlab.md#omnibus-gitlab-reconfigure).
- If you installed from source, [restart GitLab](../administration/restart_gitlab.md#installations-from-source).
2019-07-31 22:56:46 +05:30
2019-09-04 21:01:54 +05:30
On the sign in page, there should now be a Salesforce icon below the regular sign in form.
2022-07-23 23:45:48 +05:30
Select the icon to begin the authentication process. Salesforce asks the user to sign in and authorize the GitLab application.
2021-02-22 17:27:13 +05:30
If everything goes well, the user is returned to GitLab and is signed in.
2019-07-31 22:56:46 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-03-11 19:13:27 +05:30
GitLab requires the email address of each new user. After the user is signed in
using Salesforce, GitLab redirects the user to the profile page where they must
provide the email and verify the email.