このトピックでは、OIDC id_token にカスタムフィールドを追加する方法について説明し、設定例を示します。
id_token カスタムフィールドのルール
|
タイプ |
値 |
説明 |
|
変数 |
user.username |
ユーザー名。 |
|
user.displayName |
表示名。 |
|
|
user.phone (非推奨) |
国コードを含まない電話番号。この変数は非推奨です。 |
|
|
user.phoneNumber |
国コードを含まない電話番号。 |
|
|
user.email |
ユーザーのメールアドレス。 |
|
|
user.status |
ユーザーステータス。有効な値:
|
|
|
user.primaryOrganizationalUnitId |
ユーザーのプライマリ組織単位の ID。 |
|
|
user.organizationalUnits |
ユーザーが所属する組織単位。 |
|
|
ArrayMap(user.organizationalUnits, __item.organizationalUnitId) |
ユーザーが所属する組織単位の ID。 形式: JSON 配列。 |
|
|
user.groups |
ユーザーアカウントが所属するグループ。 形式: JSON 配列。 |
|
|
ArrayMap(user.groups, __item.groupId) |
ユーザーのグループ ID。 形式: JSON 配列。 |
|
|
ArrayMap(user.groups, __item.groupExternalId) |
ユーザーの外部グループ ID。 形式: JSON 配列。 |
|
|
user.customFields |
ユーザーのカスタムフィールド。 形式: JSON 配列。 |
|
|
user.customFieldMap.$fieldname$.fieldValue |
特定のカスタムフィールドの値。 |
|
|
定数 |
固定文字列値。定数は二重引用符 ("") で囲んでください。 |
|
|
式 |
値の連結または変換を行うための詳細設定機能。 詳細については、「高度なアカウント フィールド式」をご参照ください。 |
|
ユーザーオブジェクトの例:
{
...
"customFieldMap": {
"place": {
"fieldName": "place",
"fieldValue": "beijing"
},
"age": {
"fieldName": "age",
"fieldValue": "18"
}
},
"identityProviderUserMap": {
"idp_m2gngriuenktdkxxxxxx": {
"identityProviderId": "idp_m2gngriuenktdkxxxxxx",
"identityProviderType": "ding_talk",
"identityProviderExternalId": "corp_1234xxxxxxx",
"identityProviderUserId": "b2ed5fc0xxxxx"
}
},
"organizationalUnits": [
{
"organizationalUnitId": "ou_sdfadtaaxxxxxx",
"organizationalUnitName": "AD",
"primary": false
},
{
"organizationalUnitId": "ou_werttxxxxxx",
"organizationalUnitName": "name_002",
"primary": true
}
],
"primaryOrganizationalUnitId": "ou_werttxxxxxx",
"customFields": [
{
"fieldName": "place",
"fieldValue": "beijing"
},
{
"fieldName": "age",
"fieldValue": "18"
}
],
"groups": [
{
"groupId": "group_jp6al4sn4n4wjgjxxxxxx",
"groupName": "group1",
"groupExternalId": "group_jp6al4sn4n4wjgjxxxxxx"
},
{
"groupId": "group_vavikcxewkf5h3oxxxxxx",
"groupName": "group2",
"groupExternalId": "group_vavikcxewkf5h3oxxxxxx"
}
],
...
}
OIDC 式の例
Identity as a Service (IDaaS) の application ページで、[Hide advanced configuration] をクリックすると、詳細設定エリアが展開されます。[Extend id_token] セクションで、カスタムフィールド名とそれに対応する式をマッピングテーブルに追加します。
-
式
user.organizationalUnitsは、次の値を返します:[ { "organizationalUnitId": "ou_sdfadtaaxxxxxx", "organizationalUnitName": "AD", "primary": false }, { "organizationalUnitId": "ou_werttxxxxxx", "organizationalUnitName": "name_002", "primary": true } ] -
式
ArrayMap(user.organizationalUnits, __item.organizationalUnitId)は、次の値を返します:[ "ou_sdfadtaaxxxxxx", "ou_werttxxxxxx" ] -
式
user.groupsは、次の値を返します:[ { "groupId": "group_jp6al4sn4n4wjgjxxxxxx", "groupName": "group1", "groupExternalId": "group_jp6al4sn4n4wjgjxxxxxx" }, { "groupId": "group_vavikcxewkf5h3oxxxxxx", "groupName": "group2", "groupExternalId": "group_vavikcxewkf5h3oxxxxxx" } ] -
式
ArrayMap(user.groups, __item.groupId)は、次の値を返します:[ "group_jp6al4sn4n4wjgjxxxxxx", "group_vavikcxewkf5h3oxxxxxx" ] -
式
ArrayMap(user.groups, __item.groupExternalId)は、次の値を返します:[ "group_jp6al4sn4n4wjgjxxxxxx", "group_vavikcxewkf5h3oxxxxxx" ] -
式
user.customFieldsは、次の値を返します:[ { "fieldName": "place", "fieldValue": "beijing" }, { "fieldName": "age", "fieldValue": "18" } ] -
式
user.customFieldMap.age.fieldValueは、次の値を返します:18
id_token カスタムフィールドの書き換えルール
デフォルトフィールドのルール
-
システムのデフォルトフィールドは 書き換えできません:
exp、nbf、iat、iss、jti、at_hash、c_hash、nonce、sid。 -
次のフィールドの書き換えは サポートされています:
sub。
ユーザー情報フィールドのルール
id_token 内の以下のユーザー情報フィールドを書き換えられるかどうかは、リクエストされた スコープ によって異なります。
|
フィールド名 |
関連するスコープ |
書き換え不可の条件 |
|
|
|
リクエストされた |
|
|
|
リクエストされた |
|
|
|
リクエストされた |
|
|
|
リクエストされた |
設定の推奨事項
-
アプリケーションの設定でスコープを慎重に選択してください。リクエストするスコープによって、書き換え可能なユーザーフィールドが決まります。
-
特定のフィールドを書き換えるには、関連する
スコープをリクエストしないか、対応するユーザー属性が空であることを確認してください。