Kanboard
Kanboard は、カンバンボードを使用するセルフホスト型のプロジェクト管理ツールです。その OAuth2 プラグイン は、汎用 OAuth 2.0 プロバイダーを通じてユーザーを認証します。プロバイダーとして Casdoor を使用すると、ユーザーは Casdoor アカウントで Kanboard にサインインできます。
OAuth2 プラグインのインストール
- 次のいずれかの方法でプラグインをインストールします:
- Kanboard で Settings > Plugins > Plugin Directory を開き、OAuth2 をインストールします。Web インストーラーを使用するには、
config.phpでPLUGIN_INSTALLERがtrueに設定されていること、Web サーバーが書き込み可能なpluginsディレクトリが存在すること、および PHP Zip 拡張機能が有効である必要があります。 - プラグインをダウンロードし、Kanboard ディレクトリの
plugins/OAuth2に展開します。ディレクトリ名は大文字と小文字が区別されます。
- Kanboard で Settings > Plugins > Plugin Directory を開き、OAuth2 をインストールします。Web インストーラーを使用するには、
- Settings > Application settings > Application URL が Kanboard の公開 URL(例:
https://kanboard.example.com/)になっていることを確認してください。プラグインはこの URL からコールバック URL を構築します。
Casdoor でアプリケーションを作成する
-
Kanboard で Settings > Integrations > OAuth2 Authentication に移動し、Callback URL をコピーします。URL リライティングが有効な場合、次のようになります:
https://kanboard.example.com/oauth/callbackURL リライティングが無効な場合、
https://kanboard.example.com/?controller=OAuthController&action=handler&plugin=OAuth2となります。 -
Casdoor 管理者コンソールで、ユーザーの組織を開き、アプリケーションを追加するか、既存のアプリケーションを開きます。
-
コールバック URL を Redirect URLs に追加します。
-
保存し、Client ID と Client secret を控えておきます。
OAuth2 プラグインの設定
-
Kanboard で Settings > Integrations > OAuth2 Authentication に移動し、フィールドを入力します:
Field Value Client ID <your-client-id>Client Secret <your-client-secret>Authorize URL https://door.example.com/login/oauth/authorizeToken URL https://door.example.com/api/login/oauth/access_tokenUser API URL https://door.example.com/api/userinfoScopes openid profile emailUsername Key preferred_usernameName Key nameEmail Key emailUser ID Key subAllow Account Creation On <your-client-id>、<your-client-secret>: Casdoor アプリケーションからの値。- User API URL: Casdoor の UserInfo エンドポイント。
profileスコープに対してはsub(Casdoor ユーザー ID)、preferred_username(ユーザー名)、name(表示名)を返し、emailスコープに対してはemailを返します。 - User ID Key: Kanboard はこの値に基づいて Kanboard ユーザーをリンクします。Casdoor でユーザー名が変更されても
subは変わりません。 - Allow Account Creation: 初回サインイン時に Kanboard ユーザーを作成します。これを有効にしない場合、アカウントをリンク済みのユーザーのみがサインインできます。
-
Save をクリックします。
Casdoor グループの同期
UserInfo エンドポイントは groups 内にユーザーのグループ情報も返します。これらから Kanboard グループを作成するには:
- Casdoor アプリケーションの OIDC/OAuth タブで、Token group format を
Name (group)に設定します。これにより、グループはmy-org/developersではなくdevelopersとして受け取られます。 - プラグイン設定で、Groups Key を
groupsに設定します。一部のグループのみを使用する場合は、カンマ区切りで Group Filter にリストします。
既存の Kanboard ユーザーとのリンク
Kanboard は、保存された User ID Key の値によって再訪問者を認識し、ユーザー名やメールアドレスでは認識しません。Casdoor ユーザーと同じユーザー名を持つ既存の Kanboard ユーザーは、アカウントがリンクされるまで Casdoor ではサインインできません:
- ユーザーはパスワードで Kanboard にサインインし、プロフィールの外部アカウントを開いて Link OAuth2 account をクリックします。
- または、管理者がユーザーの認証設定にある OAuth2 ID フィールドに、Casdoor ユーザー ID(
sub値)を入力します。
結果の確認
- プライベートブラウザウィンドウで Kanboard を開きます。サインインページに OAuth2 login が表示されます。
- それをクリックして Casdoor にサインインします。Casdoor ユーザーとしてログインした状態で Kanboard が開かれます。
トラブルシューティング
| Symptom | Cause and fix |
|---|---|
Kanboard shows External authentication failed | The user isn't linked yet and Allow Account Creation is off, or a Kanboard user with the same username exists. Turn on account creation, or link the user. |
Casdoor shows Redirect URI: ... doesn't exist in the allowed Redirect URI list | Application URL in Kanboard is wrong, often still http://localhost/. Fix it, and add the Callback URL of the plugin to Redirect URLs. |
| The username, name, or email of new users is empty | Scopes lacks profile or email, or the application's Token fields list leaves the fields out. Casdoor returns only the fields in that list from the UserInfo endpoint. |
You use https://door.example.com/api/get-account as User API URL | That endpoint returns the user inside data. Use the UserInfo endpoint instead, as shown above. |
関連項目
- GitHub の plugin-oauth2
- OAuth 2.0