Sentry
Sentry はエラー追跡およびパフォーマンス監視プラットフォームです。その組織では、メンバーを SAML 2.0 アイデンティティプロバイダー (IdP) 経由でサインインさせることができます。Casdoor を IdP として使用すると、メンバーは Casdoor アカウントで Sentry にサインインできます。
sentry.io では、SAML2 は Business または Enterprise プランが必要です。セルフホスト型の Sentry ではバージョン 20.6.0 以降組み込まれており、機能 organizations:sso-basic および organizations:sso-saml2 はデフォルトで有効です。
Sentry の準備
Sentry は、IdP に渡す URL を system.url-prefix から構築します。セルフホスト型の Sentry では、これを sentry/config.yml で、ユーザーが開くスキームを含む公開 URL に設定します:
system.url-prefix: 'https://sentry.example.com'
変更後は Sentry を再起動してください。これがない場合、サインインは失敗し、多くの場合ユーザーが Casdoor から戻った後に HTTP 500 エラーが発生します。
Casdoor でアプリケーションを作成する
例では Sentry で組織スラッグ my-org を使用しています。あなたのスラッグは組織設定の URL で確認できます。
-
Casdoor 管理コンソールで、ユーザーの組織を開き、アプリケーションを追加するか、既存のものを開きます。
-
Sentry のエンティティ ID を Redirect URLs に追加します。Sentry はメタデータ URL をエンティティ ID として使用します:
https://sentry.example.com/saml/metadata/my-org/ -
SAML タブで、SAML reply URL を Sentry のアサーションコンシューマーサービス (ACS) URL に設定します:
https://sentry.example.com/saml/acs/my-org/ -
Enable SAML assertion signature と Enable SAML C14N10 はオフのままにしてください。Casdoor は SAML レスポンスに署名し、Sentry がそれを検証します。アサーション署名をオンにすると、Sentry は
Signature validation failed. SAML Response rejectedというエラーでレスポンスを拒否します。 -
保存し、Copy SAML metadata URL をクリックします。URL はこの形式になります:
https://door.example.com/api/saml/metadata?application=admin/<application-name>
Sentry で SAML2 を設定する
-
Sentry で、組織の Settings > Auth に移動し、SAML2 の横にある Configure をクリックします。
-
Metadata URL タブで、Casdoor のメタデータ URL を Metadata URL に入力し、Get metadata をクリックします。
Sentry が Casdoor に到達できない場合は、ブラウザでメタデータ URL を開き、XML を XML タブの Metadata XML に貼り付けてください。
-
Casdoor が送信する属性をマッピングします:
Field Value IdP User ID NameUser Email EmailFirst Name DisplayNameLast Name (empty) Casdoor はユーザー名を
Name属性に、表示名をDisplayNameに送信します。レスポンス内のユーザープロファイルを参照してください。 -
保存します。Auth ページには、組織のプロバイダーとして SAML2 が表示されます。既存のメンバーにアカウントを Casdoor にリンクするよう依頼するには、このページからリマインダーを送信してください。
結果の確認
- プライベートブラウザウィンドウで
https://sentry.example.com/auth/login/my-org/を開き、シングルサインオンでサインインします。 - Casdoor にサインインします。Casdoor ユーザーでサインインした状態で Sentry が組織を開きます。まだメンバーでないユーザーは、この初回サインイン時に組織のデフォルトロールでメンバーになります。
トラブルシューティング
| Symptom | Cause and fix |
|---|---|
SAML SSO failed, Signature validation failed. SAML Response rejected | Turn off Enable SAML assertion signature and Enable SAML C14N10 on the application. If it persists, fetch the metadata again: Sentry must have the certificate of the application's current Cert. |
Failed to map SAML attributes | An attribute name in the mapping doesn't match. The message lists the attribute names that the response contains. Check that Disable SAML attributes is off. |
Casdoor shows AssertionConsumerServiceURL: ... doesn't match the SAML reply URL or the allowed Redirect URI list | Set SAML reply URL to the ACS URL of Sentry, with the organization slug and the trailing slash. |
| Sentry returns HTTP 500 after the sign-in | system.url-prefix isn't set or differs from the URL that users open. Fix it and restart Sentry. |
| Get metadata fails with a certificate error | Sentry checks the TLS certificate of Casdoor. Serve Casdoor with a valid certificate, or paste the metadata XML instead. |
関連項目
- SAML2 Sentryドキュメント内
- CasdoorをSAMLアイデンティティプロバイダーとして使用