> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/jp/secrets-manager/about/linked-credentials.md).

# リンク済み認証情報

## 概要 <a href="#about" id="about"></a>

KeeperのレコードはGraphSyncを通じて相互にリンクできます。最も一般的な用途はPrivileged Access Managerです。PAMリソースレコード ([PAMマシン、データベース、ディレクトリ、またはリモートブラウザ](/keeperpam/jp/secrets-manager/about/pam-record-types.md)) は、そのリソースを操作する `pamUser` レコードとリンクされ、各ユーザーが許可されている操作を示すメタデータも含まれます。

シークレットマネージャーSDKでは各レコードからこれらのリンクを取得できるため、たとえば特定のマシンの管理ユーザーと接続用認証情報を特定できます。

{% hint style="info" %}
リンクは要求した場合にのみ返されます。リンクの取得は応答サイズと処理時間を増やすため、必要な場合にのみ要求してください。
{% endhint %}

## リンク済みレコードの取得 <a href="#retrieving-linked-records" id="retrieving-linked-records"></a>

シークレットクエリに request-links オプションを渡します。各SDKではクエリオプションオブジェクトで指定します。言語ごとのメソッド名とフラグ名は、以下のクロスSDKリファレンスをご参照ください。

```python
from keeper_secrets_manager_core import SecretsManager
from keeper_secrets_manager_core.storage import FileKeyValueStorage
from keeper_secrets_manager_core.dto.payload import QueryOptions

secrets_manager = SecretsManager(config=FileKeyValueStorage('ksm-config.json'))

# request links along with the records
# QueryOptions takes records_filter and folders_filter first; pass None for both to fetch everything
query = QueryOptions(records_filter=None, folders_filter=None, request_links=True)
records = secrets_manager.get_secrets_with_options(query)

for record in records:
    for link in record.links:
        print(f"{record.title} ({record.type}) -> {link['recordUid']}")
        if link.get('path'):
            print(f"  path: {link['path']}")
```

{% hint style="warning" %}
リンクは要求した場合にのみ取得できます。空と未設定の挙動はSDKごとに異なります。**Java/Kotlin**はリンク未要求時に `null` を返し、要求済みで存在しない場合は空リストを返します。**PythonおよびRust**はどちらの場合も空コレクションを返すため (「未要求」と「存在しない」を区別できません)、反復処理前に空かどうかを確認してください。
{% endhint %}

{% hint style="info" %}
リンクはリソースレコード (PAMマシン/データベース/ディレクトリ/リモートブラウザ) に表示されます。`pamUser` レコード自身の `links` は常に空です。逆参照はありません。ユーザーが操作するすべてのマシンを見つけるには、リソースレコードを順に確認してください。
{% endhint %}

## リンクオブジェクトの構造 <a href="#link-object-structure" id="link-object-structure"></a>

各リンクは3つのフィールドを持つオブジェクトです。

| フィールド       | 型                 | 説明                                          |
| ----------- | ----------------- | ------------------------------------------- |
| `recordUid` | String            | リンク先レコードのUID                                |
| `data`      | String (optional) | Base64エンコードされたリンクペイロード。エッジにデータがない場合は `null` |
| `path`      | String (optional) | `data` の意味を識別。基本的なユーザーリンクの場合は `null`        |

`path` の値によって `data` の解釈方法が決まります。

| `path`         | `data` の内容                      | 備考                                                 |
| -------------- | ------------------------------- | -------------------------------------------------- |
| `null` / empty | ユーザーリンクメタデータ、JSON (snake\_case) | `recordUid` はリンク先の `pamUser`。管理者/接続/IAM/ローテーションフラグ |
| `meta`         | リソース自身の設定、JSON (camelCase)      | `recordUid` はリソース自身のUID (自己参照)                     |
| `ai_settings`  | 暗号化Blob                         | リソースレコード自身のキーで復号                                   |
| `jit_settings` | 暗号化Blob                         | ジャストインタイムアクセス構成。レコード自身のキーで復号                       |
| `domain`       | リンクエッジ                          | マシンからディレクトリへの参照。JITルックアップで使用                       |

### ユーザーリンクデータ (`path` が null)

デコード後のJSON。キーは snake\_case。すべてのフィールドは任意。欠落時は false/未設定として扱います。

```json
{
  "is_admin": true,
  "is_launch_credential": true,
  "is_iam_user": false,
  "belongs_to": true,
  "rotation_settings": { "schedule": "", "disabled": false, "noop": false }
}
```

### メタリンクデータ (`path` が "meta")

デコード後のJSON。キーは camelCase。

```json
{
  "version": 1,
  "allowedSettings": {
    "rotation": true,
    "connections": true,
    "portForwards": true,
    "sessionRecording": true,
    "typescriptRecording": true,
    "aiEnabled": false
  },
  "rotateOnTermination": false
}
```

{% hint style="warning" %}
ユーザーリンクの `data` は**snake\_case**キー、メタリンクの `data` は**camelCase**です。型付きでないリンクを返すSDK (Java/Kotlin以外) では、この変換は利用側の責任となります。
{% endhint %}

## クロスSDKリファレンス <a href="#cross-sdk-reference" id="cross-sdk-reference"></a>

リンク済みレコードに対応するすべてのSDKは同じワイヤーフィールドを公開します。表面は言語ごとに異なります。

|                   | クエリメソッド                           | Request-linksフラグ | リンクアクセサ             | リンク形状                               |
| ----------------- | --------------------------------- | ---------------- | ------------------- | ----------------------------------- |
| **Java / Kotlin** | `getSecrets2(opts, qopts)`        | `requestLinks`   | `record.getLinks()` | 型付き `KeeperRecordLink` (22ヘルパーメソッド) |
| **Python**        | `get_secrets_with_options(qopts)` | `request_links`  | `record.links`      | dictのリスト                            |
| **JavaScript**    | `getSecrets2(opts, qopts)`        | `requestLinks`   | `record.links`      | `{recordUid, data?, path?}`         |
| **.NET**          | `GetSecrets2(opts, qopts)`        | `RequestLinks`   | `record.Links`      | 型付き `KeeperRecordLink` (プロパティ)      |
| **Go**            | `GetSecretsWithOptions(qopts)`    | `RequestLinks`   | `record.Links`      | 型付き `RecordLink` struct             |
| **Rust**          | `get_secrets_with_options(qopts)` | `request_links`  | `record.links`      | `Vec<HashMap<String, Value>>`       |

現時点でリンクデータに対する型付きアクセサメソッドを提供しているのは**Java/Kotlin**SDKのみです。他のSDKは生の `{recordUid, data, path}` 構造を返すため、`data` の解析は利用側で行います。型付きAPIの完全な一覧は、[Javaリンク済み認証情報リファレンス](/keeperpam/jp/secrets-manager/developer-sdk-library/java-sdk/linked-credentials-on-pam-records.md)をご参照ください。

## メソッドリファレンス (Java / Kotlin) <a href="#method-reference-java-kotlin" id="method-reference-java-kotlin"></a>

型付き `KeeperRecordLink` メソッドのリファレンスです。他のSDKも同じ基盤ワイヤーフィールドを読み取ります。

<table><thead><tr><th>メソッド</th><th width="160">戻り値</th><th>説明</th></tr></thead><tbody><tr><td><code>getRecordUid()</code></td><td><code>String</code></td><td>対象レコードUID</td></tr><tr><td><code>getPath()</code></td><td><code>String</code></td><td>リンクメタデータタイプ</td></tr><tr><td><code>getData()</code></td><td><code>String</code></td><td>生のBase64リンクデータ</td></tr><tr><td><code>isAdminUser()</code></td><td><code>boolean</code></td><td>ユーザーに管理者権限あり</td></tr><tr><td><code>isLaunchCredential()</code></td><td><code>boolean</code></td><td>接続用認証情報</td></tr><tr><td><code>allowsRotation()</code></td><td><code>boolean</code></td><td>パスワードローテーション許可</td></tr><tr><td><code>allowsConnections()</code></td><td><code>boolean</code></td><td>接続許可</td></tr><tr><td><code>allowsPortForwards()</code></td><td><code>boolean</code></td><td>ポートフォワーディング許可</td></tr><tr><td><code>allowsSessionRecording()</code></td><td><code>boolean</code></td><td>セッション記録有効</td></tr><tr><td><code>allowsTypescriptRecording()</code></td><td><code>boolean</code></td><td>Typescript記録有効</td></tr><tr><td><code>allowsRemoteBrowserIsolation()</code></td><td><code>boolean</code></td><td>RBI許可</td></tr><tr><td><code>rotatesOnTermination()</code></td><td><code>boolean</code></td><td>セッション終了時にローテーション</td></tr><tr><td><code>getDecodedData()</code></td><td><code>String</code></td><td>復号なしのBase64デコード</td></tr><tr><td><code>getDecryptedData(byte[])</code></td><td><code>String</code></td><td>レコードキーでデータを復号</td></tr><tr><td><code>getAiSettingsData(byte[])</code></td><td><code>Map</code></td><td>AI設定へのアクセス</td></tr><tr><td><code>getJitSettingsData(byte[])</code></td><td><code>Map</code></td><td>JIT設定へのアクセス</td></tr><tr><td><code>getSettingsForPath(String, byte[])</code></td><td><code>Map</code></td><td>パス指定による汎用設定アクセス</td></tr></tbody></table>

## 重要な注意事項 <a href="#important-notes" id="important-notes"></a>

* **`linksToRemove` はファイルを削除し、レコードリンクは削除しません。** 更新オプションの `linksToRemove` パラメーターはファイル添付を削除します。GraphSyncレコードリンクは削除しません。
* **暗号化:** `ai_settings` および `jit_settings` ペイロードはリソースレコード自身のキーで暗号化されています。頂点/キーチェーンキーではなく、そのキーで復号してください。
* **パフォーマンス:** リンクの要求は応答サイズと処理時間を増やします。可能な限りレコードをフィルターしてください。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/secrets-manager/about/linked-credentials.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
