認証方式

合成モニタリングでは、アプリケーションの多くの認証方式がサポートされています。

第一要素の認証方式。

認証方式(Authentication Method) 説明

ユーザー名およびパスワード

クレデンシャル Vault を使用してサポート

シングルサインオン(SSO)

ログイン情報をクレデンシャル Vault に保存できます。次に、スクリプトの SSO URL とログイン情報を使用します。

パスキー

パスキーをクレデンシャル Vault に保存します。次に、スクリプトでパスキーを使用します。

証明書ベースの認証

クレデンシャル Vault を使用して証明書を保存します。

Microsoft AD

Microsoft AD でサービスアカウントを作成します。次に、スクリプトでサービスアカウントを使用します。

多要素認証方式

  • SMS
  • メールアドレス
  • Azure AD
  • 時間ベースのワンタイムパスワード(TOTP):Web モニタリングには pyotp ライブラリを、 API モニタリングには otpib を使用できます。以下に、これらのライブラリの使用方法の例を示します。
    Web モニタリング
    PYTHON
    import time
    import pyotp
    from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.support.ui import WebDriverWait
    
    TOTP_SECRET = '<%totp_secret%>'
    
    # Initialize the TOTP generator
    totp = pyotp.TOTP(TOTP_SECRET)
    
    
    # Generate the current TOTP code and send it to OTP field
    totp_code = totp.now()
    auth_field=wait.until(EC.visibility_of_element_located((By.ID, 'app_totp')))
    auth_field.send_keys(totp_code)
    API モニタリング
    JAVASCRIPT
    const { totp } = require('otplib')
    // Replace these with your actual values
    const apiUrl = 'https://api.github.com/user';
    const personalAccessToken = '<%TOKEN-IN-CREDENTIALS-VAULT%>';
    const totpSecret = '<%base64-secret-stored-in-secrets%>';
    // Generate TOTP code
    const totpCode = totp.generate(totpSecret);
    async function callGitHubApiWithMfa() {
    try {
    var response = await client.get(apiUrl, {
    headers: {
    'Authorization': `token ${personalAccessToken}`,
    'X-GitHub-OTP': totpCode
    }
    });
    console.log('API Response:', response.body);
    } catch (error) {
    console.error('Error calling GitHub API:', error.response ? error.response.data : error.message);
    }
    }
    callGitHubApiWithMfa();