{{< details >}}
- Tier: 基础版, 专业版, 旗舰版
- Offering: 私有化部署
{{< /details >}}
要启用 Atlassian OmniAuth 作为无密码身份验证的提供者,您必须在 Atlassian 中注册一个应用程序。
Atlassian 应用程序注册
- 前往 Atlassian 开发者控制台,使用 Atlassian 账户登录以管理应用程序。
- 选择 创建一个新应用。
- 选择一个应用名称,例如 ‘极狐GitLab’,然后选择 创建。
- 记录下用于极狐GitLab 配置步骤的
Client ID
和Secret
。 - 在左侧侧边栏的 APIS AND FEATURES 下,选择 OAuth 2.0 (3LO)。
- 使用格式
https://gitlab.example.com/users/auth/atlassian_oauth2/callback
输入极狐GitLab 回调 URL,然后选择 保存变更。 - 在左侧侧边栏的 APIS AND FEATURES 下,选择 + 添加。
- 为 Jira platform REST API 选择 添加,然后选择 配置。
- 选择下列范围旁边的 Add:
- 查看 Jira 议题数据
- 查看用户个人资料
- 创建并管理议题
极狐GitLab 配置
-
在您的极狐GitLab 服务器上,打开配置文件:
对于 Linux 软件包安装:
sudo editor /etc/gitlab/gitlab.rb
对于自行编译的安装:
sudo -u git -H editor /home/git/gitlab/config/gitlab.yml
- 配置公共设置以添加
atlassian_oauth2
作为单点登录提供者。这为没有现有极狐GitLab 帐户的用户启用即时账户配置。 -
添加 Atlassian 的提供者配置:
对于 Linux 软件包安装:
gitlab_rails['omniauth_providers'] = [ { name: "atlassian_oauth2", # label: "Provider name", # optional label for login button, defaults to "Atlassian" app_id: "<your_client_id>", app_secret: "<your_client_secret>", args: { scope: "offline_access read:jira-user read:jira-work", prompt: "consent" } } ]
对于自行编译的安装:
- { name: "atlassian_oauth2", # label: "Provider name", # optional label for login button, defaults to "Atlassian" app_id: "<your_client_id>", app_secret: "<your_client_secret>", args: { scope: "offline_access read:jira-user read:jira-work", prompt: "consent" } }
- 将
<your_client_id>
和<your_client_secret>
更改为您在应用程序注册期间收到的客户端凭据。 -
保存配置文件。
- 要使更改生效:
- 如果您使用 Linux 软件包安装,重新配置极狐GitLab。
- 如果您自行编译了安装,重新启动极狐GitLab。
在登录页面上,现在应该在常规登录表单下面有一个 Atlassian 图标。选择该图标以开始身份验证过程。
如果一切顺利,用户将使用其 Atlassian 凭据登录极狐GitLab。