AtlassianをOAuth 2.0の認証プロバイダーとして使用
- プラン: Free、Premium、Ultimate
- 提供形態: GitLab Self-Managed
パスワードなしの認証のためにAtlassianのOmniAuthプロバイダーを有効にするには、Atlassianにアプリケーションを登録する必要があります。
Atlassianアプリケーション登録
- Atlassian developer consoleにアクセスし、Atlassianアカウントでサインインしてアプリケーションを管理します。
- Create a new appを選択します。
- アプリ名(‘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の下にある**+ Add**を選択します。
- Jira platform REST APIに対して追加を選択し、次に設定するを選択します。
- 次のスコープの横にある追加を選択します:
- View Jira issue data
- View user profiles
- Create and manage issues
GitLab設定
GitLabサーバーで、設定ファイルを開きます:
Linuxパッケージインストールの場合:
sudo editor /etc/gitlab/gitlab.rb自己コンパイルによるインストールの場合:
sudo -u git -H editor /home/git/gitlab/config/gitlab.yml共通設定で、
atlassian_oauth2をシングルサインオンプロバイダーとして追加します。これにより、既存のGitLabアカウントを持たないユーザーに対して、Just-In-Timeアカウントプロビジョニングが有効になります。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にサインインされます。