
# 연결의 속성 매핑 조회

`GET /v1/connections/{connection_id}/attribute-mappings` · 권한 `connections:read`

기업 연결(SAML 또는 OIDC)의 속성 매핑 규칙을 대상별로 정렬하여 반환합니다. 각 규칙은 ID 공급자가 보낸 속성 또는 클레임(`source_name`)을 사용자 필드(`target`)에 연결합니다. `ETag` 헤더에는 목록의 버전이 담겨 있으며, 목록을 교체하거나 사전 설정 프로필을 적용할 때 `If-Match`로 보내야 합니다. 저장된 규칙이 없는 연결은 빈 목록을 반환하며, 로그인 시에는 템플릿 기본값이 적용됩니다(OIDC는 `generic` 프로필, SAML은 매핑되지 않음). 조회는 감사 기록되지 않습니다.

## 요청

| 필드 | 유형 | 필수 | 설명 |
|---|---|---|---|
| `connection_id` | 경로 | 예 | 기업 연결 ID(`conn_…`). |

## 응답

목록과 `ETag`가 포함된 `200 OK`.

```json
{
  "attribute_mappings": [
    {
      "target": "email",
      "source_name": "email",
      "source_name_format": null,
      "overwrite": "always",
      "profile": "okta"
    },
    {
      "target": "user_metadata.department",
      "source_name": "department",
      "source_name_format": "urn:oasis:names:tc:SAML:2.0:attrname-format:basic",
      "overwrite": "if_empty",
      "profile": "generic"
    }
  ]
}
```

| 필드 | 설명 |
|---|---|
| `target` | `email`, `given_name`, `family_name`, `name`, `locale`, `zoneinfo`, `phone`, `groups` 또는 `user_metadata.<key>`. |
| `source_name` | SAML 속성 `Name` 또는 OIDC 클레임 이름(점으로 구분된 경로, 깊이 ≤ 3). |
| `source_name_format` | 속성을 읽을 때 사용하는 SAML `NameFormat`; `null`이면 이름으로만 일치합니다. |
| `overwrite` | `always`(로그인할 때마다), `if_empty`(필드가 비어 있을 때만) 또는 `never`(생성 시에만). |
| `profile` | 규칙의 출처가 된 사전 설정; 직접 작성한 규칙은 `generic`. |

## 오류

| HTTP | code | 발생 조건 |
|---|---|---|
| 404 | `not_found` | 이 환경에 연결이 없거나 기업 연결이 아닙니다. |
| 401 | `unauthenticated` | 자격 증명이 없거나 잘못되었거나 폐기되었습니다. |
| 403 | `insufficient_permissions` | 자격 증명에 필요한 권한이 없습니다. |
| 429 | `rate_limited` | 요청 한도를 초과했습니다. `Retry-After` 기간이 지난 후 다시 시도하십시오. |
| 503 | `service_unavailable` | 종속 서비스를 일시적으로 사용할 수 없습니다. `Retry-After` 기간이 지난 후 다시 시도하십시오. |

## 예시

```bash
curl -i "https://api.eu.keenauth.com/v1/connections/conn_01j9xp6q0r1s5t7v9w1x3y5z7b/attribute-mappings" \
  -H "Authorization: Bearer $KEENAUTH_SECRET_KEY"
```

```bash
keenauth connections attribute-mappings get conn_01j9xp6q0r1s5t7v9w1x3y5z7b
```
