すべてのプロダクト
Search
ドキュメントセンター

Identity as a Service:SAML 属性ステートメント値の仕様

最終更新日:Jun 21, 2026

このトピックでは、SAML 属性ステートメントで値を設定するための仕様について説明し、設定例を紹介します。

属性ステートメントの値

タイプ

説明

変数

user.username

ユーザー名。

user.displayName

表示名。

user.phone (非推奨)

国コードを除いた携帯電話番号 (非推奨)。

user.phoneNumber

国コードを除いた携帯電話番号。

user.email

メールアドレス。

user.status

ユーザーステータス。有効な値:

  • enabled

  • disabled

user.primaryOrganizationalUnitId

ユーザーのプライマリ組織単位の ID。

ObjectToJsonString(user.organizationalUnits)

ユーザーが所属する組織単位。

形式:JSON 配列文字列。

ArrayJoin(ArrayMap(user.organizationalUnits, __item.organizationalUnitId), ",")

ユーザーが所属する組織単位の ID。

形式:カンマ区切りの文字列。

ObjectToJsonString(user.groups)

アカウントが所属するグループ。

形式:JSON 配列文字列。

ArrayJoin(ArrayMap(user.groups, __item.groupId), ",")

アカウントが所属するグループの ID。

形式:カンマ区切りの文字列。

ArrayJoin(ArrayMap(user.groups, __item.groupExternalId), ",")

アカウントが所属するグループの外部 ID。

形式:カンマ区切りの文字列。

ObjectToJsonString(user.customFields)

すべてのカスタムフィールド。

形式:JSON 配列文字列。

user.customFieldMap.$fieldname$.fieldValue

カスタムフィールドの値。$fieldname$ はフィールド名に置き換えてください。

appUser.username

アプリケーションアカウント。

定数

固定文字列。値は二重引用符 ("") で囲みます。

値を柔軟に連結および変換できる高度な機能です。

詳細については、「advanced account field expressions」をご参照ください。

SAML 式の例

ユーザーオブジェクトのサンプル

{
  ...
  "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"
        }
    ],
  ...
}

SAML コンソール設定の例

SAML アプリケーションの設定ページで、[Signing Algorithm]SHA256 を選択します (RSA-SHA256 のみサポートされています)。[Attribute Statements] セクションで、次の属性マッピングを設定します:organizationalUnitsObjectToJsonString(user.organizationalUnits)organizationalUnitIdsArrayJoin(ArrayMap(user.organizationalUnits, __item.organizationalUnitId), ",")groupsObjectToJsonString(user.groups)groupIdsArrayJoin(ArrayMap(user.groups, __item.groupId), ",")groupExternalIdsArrayJoin(ArrayMap(user.groups, __item.groupExternalId), ",")groupIdArraySamlArray(ArrayMap(user.groups, __item.groupId))customFieldsObjectToJsonString(user.customFields)ageuser.customFieldMap.age.fieldValue。この設定により、これらの追加ユーザーフィールドが SAML レスポンスで返され、アプリケーション側で解析できます。[SSO initiator][Support portal and application initiated] を選択します。これにより、ユーザーは Alibaba Cloud IDaaS ポータルページ、またはアプリケーションのいずれからでも SSO を開始できます。

生成されるSAML アサーションの例

  1. ObjectToJsonString(user.organizationalUnits) は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="organizationalUnits" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        [{"organizationalUnitId":"ou_sdfadtaaxxxxxx","organizationalUnitName":"AD","primary":false},{"organizationalUnitId":"ou_werttxxxxxx","organizationalUnitName":"name_002","primary":true}]
      </saml2:AttributeValue>
    </saml2:Attribute>
  2. ArrayJoin(ArrayMap(user.organizationalUnits, __item.organizationalUnitId), ",") は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="organizationalUnitIds" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        ou_sdfadtaaxxxxxx,ou_werttxxxxxx
      </saml2:AttributeValue>
    </saml2:Attribute>
  3. ObjectToJsonString(user.groups) は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="groups" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        [{"groupId":"group_jp6al4sn4n4wjgjxxxxxx","groupName":"group1","groupExternalId":"group_jp6al4sn4n4wjgjxxxxxx"},{"groupId":"group_vavikcxewkf5h3oxxxxxx","groupName":"group2","groupExternalId":"group_vavikcxewkf5h3oxxxxxx"}]
      </saml2:AttributeValue>
    </saml2:Attribute>
  4. ArrayJoin(ArrayMap(user.groups, __item.groupId), ",") は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="groupIds" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        group_jp6al4sn4n4wjgjxxxxxx,group_vavikcxewkf5h3oxxxxxx
      </saml2:AttributeValue>
    </saml2:Attribute>
  5. ArrayJoin(ArrayMap(user.groups, __item.groupExternalId), ",") は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="groupExternalIds" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        group_jp6al4sn4n4wjgjxxxxxx,group_vavikcxewkf5h3oxxxxxx
      </saml2:AttributeValue>
    </saml2:Attribute>
  6. SamlArray(ArrayMap(user.groups, __item.groupId)) は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="groupIdArray" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        group_jp6al4sn4n4wjgjxxxxxx
      </saml2:AttributeValue>
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        group_vavikcxewkf5h3oxxxxxx
      </saml2:AttributeValue>
    </saml2:Attribute>
  7. ObjectToJsonString(user.customFields) は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="customFields" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        [{"fieldName":"place","fieldValue":"beijing"},{"fieldName":"age","fieldValue":"18"}]
      </saml2:AttributeValue>
    </saml2:Attribute>
  8. user.customFieldMap.age.fieldValue は、次の SAML アサーションを生成します:

    <saml2:Attribute Name="age" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
      <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">
        18
      </saml2:AttributeValue>
    </saml2:Attribute>