このトピックでは、SAML 属性ステートメントで値を設定するための仕様について説明し、設定例を紹介します。
属性ステートメントの値
|
タイプ |
値 |
説明 |
|
変数 |
|
ユーザー名。 |
|
|
表示名。 |
|
|
|
国コードを除いた携帯電話番号 (非推奨)。 |
|
|
|
国コードを除いた携帯電話番号。 |
|
|
|
メールアドレス。 |
|
|
|
ユーザーステータス。有効な値:
|
|
|
|
ユーザーのプライマリ組織単位の ID。 |
|
|
|
ユーザーが所属する組織単位。 形式:JSON 配列文字列。 |
|
|
|
ユーザーが所属する組織単位の ID。 形式:カンマ区切りの文字列。 |
|
|
|
アカウントが所属するグループ。 形式:JSON 配列文字列。 |
|
|
|
アカウントが所属するグループの ID。 形式:カンマ区切りの文字列。 |
|
|
|
アカウントが所属するグループの外部 ID。 形式:カンマ区切りの文字列。 |
|
|
|
すべてのカスタムフィールド。 形式:JSON 配列文字列。 |
|
|
|
カスタムフィールドの値。 |
|
|
|
アプリケーションアカウント。 |
|
|
定数 |
固定文字列。値は二重引用符 ("") で囲みます。 |
|
|
式 |
値を柔軟に連結および変換できる高度な機能です。 詳細については、「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] セクションで、次の属性マッピングを設定します:organizationalUnits → ObjectToJsonString(user.organizationalUnits)、organizationalUnitIds → ArrayJoin(ArrayMap(user.organizationalUnits, __item.organizationalUnitId), ",")、groups → ObjectToJsonString(user.groups)、groupIds → ArrayJoin(ArrayMap(user.groups, __item.groupId), ",")、groupExternalIds → ArrayJoin(ArrayMap(user.groups, __item.groupExternalId), ",")、groupIdArray → SamlArray(ArrayMap(user.groups, __item.groupId))、customFields → ObjectToJsonString(user.customFields)、age → user.customFieldMap.age.fieldValue。この設定により、これらの追加ユーザーフィールドが SAML レスポンスで返され、アプリケーション側で解析できます。[SSO initiator] は [Support portal and application initiated] を選択します。これにより、ユーザーは Alibaba Cloud IDaaS ポータルページ、またはアプリケーションのいずれからでも SSO を開始できます。
生成されるSAML アサーションの例
-
式
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> -
式
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> -
式
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> -
式
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> -
式
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> -
式
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> -
式
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> -
式
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>