diff --git a/book/src/integrations/oauth2/examples.md b/book/src/integrations/oauth2/examples.md index b5b03bc5e..dd589e9a4 100644 --- a/book/src/integrations/oauth2/examples.md +++ b/book/src/integrations/oauth2/examples.md @@ -156,6 +156,246 @@ To set up a self-managed GitLab instance to authenticate with Kanidm: Once GitLab is up and running, you should now see a "Kanidm" option on your GitLab sign-in page below the normal login form. +## JetBrains Hub and YouTrack + +> These instructions were tested with the on-prem version of JetBrains YouTrack +> 2024.3.44799 and its built-in Hub. + +[JetBrains Hub](https://www.jetbrains.com/hub/) is an authentication and +authorisation system for TeamCity and YouTrack, which also provides a "single +pane of glass" view of those applications. + +TeamCity is a CI/CD tool, and YouTrack is a project and issue management tool. + +The on-prem version of YouTrack comes with a built-in version of Hub, which it +uses for all authentication. + +[JetBrains Hub supports OAuth2](https://www.jetbrains.com/help/hub/oauth2-authentication-module.html), +but has some limitations: + +* JetBrains Hub's OAuth2 Auth Module does not support PKCE (as a client), + [which is a security issue][pkce-disable-security]. + +* JetBrains Hub does not automatically update profile attributes after account + creation. + + However, users can update their own profile manually. + +* JetBrains Hub does not support using an auto-configuration URL, which means + you have to set a lot of options manually (which this guide will describe). + +To set up YouTrack (with its built-in JetBrains Hub) to authenticate with Kanidm +using OAuth2: + +1. Add an email address to your regular Kanidm account, if it doesn't have one + already: + + ```sh + kanidm person update your_username -m your_username@example.com + ``` + +2. Create a new Kanidm group for your YouTrack users (`youtrack_users`), and + add your regular account to it: + + ```sh + kanidm group create youtrack_users + kanidm group add-members youtrack_users your_username + ``` + +3. Create a new OAuth2 application configuration in Kanidm (`youtrack`), + disable the PKCE requirement ([this is insecure][pkce-disable-security], but + YouTrack doesn't support it), and scope access to the `youtrack_users` group: + + ```sh + kanidm system oauth2 create youtrack YouTrack https://youtrack.example.com + kanidm system oauth2 warning-insecure-client-disable-pkce youtrack + kanidm system oauth2 update-scope-map gitlab gitlab_users email openid profile groups + ``` + +4. **(optional)** By default, Kanidm presents the account's full SPN (eg: + `your_username@kanidm.example.com`) as its "preferred username". + + You can set `youtrack` to use a short username (eg: `your_username`) with: + + ```sh + kanidm system oauth2 prefer-short-username youtrack + ``` + +5. Log in to YouTrack with an account that has full system administrator + rights. + +6. Open the Auth Modules configuration in YouTrack + (⚙️ Administration → Access Management → Auth + Modules) + +7. Click New module → OAuth2, and enter the following + details: + + * Name: `Kanidm` + * Authorization URL: `https://kanidm.example.com/ui/oauth2` + + Click Create, and you'll be taken to the Auth Module's settings page. + +8. Copy the Redirect URI from YouTrack and set it in Kanidm: + + ```sh + kanidm system oauth2 add-redirect-url youtrack https://youtrack.example.com/hub/... + ``` + +9. Configure the Kanidm Auth Module as follows: + +