メインコンテンツにスキップ

Jenkins plugin

The Casdoor Jenkins plugin lets users sign in to Jenkins via Casdoor. This guide configures the plugin.

以下はいくつかの設定項目です:

CASDOOR_HOSTNAME:Casdoorサーバーがデプロイされているドメイン名またはIP。

JENKINS_HOSTNAME:Jenkinsがデプロイされているドメイン名またはIP。

ステップ1:CasdoorとJenkinsをデプロイする

Deploy Casdoor and Jenkins.

デプロイが成功したら、以下を確認してください:

  1. JenkinsのURL(Manage Jenkins -> Configure System -> Jenkins Location)をJENKINS_HOSTNAMEに設定します。 JenkinsのURL
  2. Casdoorにログインして正常に使用できることを確認します。
  3. Casdoorのorigin値(conf/app.conf)をCASDOOR_HOSTNAMEに設定します。 Casdoor設定

ステップ2:Casdoorアプリケーションを設定する

  1. 新しいCasdoorアプリケーションを作成するか、既存のものを使用します。
  2. リダイレクトURLを追加します:http://JENKINS_HOSTNAME/securityRealm/finishLogin Casdoorアプリケーション設定
  3. 必要なプロバイダーを追加し、追加の設定を行います。

Note Client ID and Client secret from the application page for the next step.

お気に入りのブラウザを開いて、http://CASDOOR_HOSTNAME/.well-known/openid-configurationにアクセスし、CasdoorのOIDC設定を表示します。

ステップ3:Jenkinsを設定する

Install the Casdoor plugin from the Jenkins marketplace or by uploading the plugin JAR.

インストールが完了したら、Manage Jenkins -> Configure Global Securityに移動します。

提案:Jenkinsのconfig.xmlファイルをバックアップし、設定エラーの場合に復旧に使用します。

Jenkinsの設定

  1. セキュリティ領域セクションで、「Casdoor認証プラグイン」を選択します。
  2. Casdoorエンドポイントフィールドに、先ほど言及したCASDOOR_HOSTNAMEを入力します。
  3. クライアントIDフィールドに、先ほど言及したClient IDを入力します。
  4. クライアントシークレットフィールドに、先ほど言及したClient secretを入力します。
  5. JWT Public Key: In Casdoor open Cert, edit your application’s cert, and copy the public key. JWT公開鍵
  6. Organization Name and Application Name are optional; use them to restrict verification to specific orgs/apps. If empty, the plugin uses the default organization and application.
  7. 認証セクションで、「ログインしたユーザーは何でもできる」をチェックします。 「匿名の読み取りアクセスを許可する」を無効にします。
  8. Saveをクリックします。

これで、Jenkinsは自動的にCasdoorにリダイレクトして認証を行います。