トークン属性ルールの管理
トークン属性ルールREST APIを使用して、トークン発行者の信頼ドキュメントのトークン属性ルールを表示および管理できます。
cURLコマンドの例では、URL構造を使用しています:
http(s)://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule
次の方法を使用事例で示します。
-
トークン属性ルールの作成
-
トークン属性ルールの変更
-
トークン属性ルールの表示
-
トークン属性ルールの削除
トークン属性ルールREST APIを使用してトークン属性ルールを管理するには:
- cURLコマンド・ラインでヘッダーを指定します。
-H Accept:application/json
- 次のコマンドを実行して、識別子が
myidentifier1
で発行者名がwww.abccompany.com
のトークン属性ルールを、信頼できる発行者ドキュメントmyTrustDocument
に作成します:curl -i -X POST -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule
例
curl -i -X POST -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule
「TokenAttributeRuleの作成」を参照してください。
次に、単一のトークン属性ルールを指定したリクエスト本文の例を示します。
[ { "identifier": "myidentifier1", "issuername": "www.abccompany.com" } ]
次にリクエストの成功を示すレスポンスの例を示します。
{ "STATUSCODE": "20101", "MESSAGE": "TokenAttributeRule \"[identifier:myidentifier1, issuername:www.abccompany.com]\" are successfully created." }
注意:
名前ID、プロキシ、仮想ユーザーおよび属性をトークン属性ルールに追加するには、次を参照してください:
- 次のコマンドを実行して、名前ID、仮想ユーザーおよび属性を指定して、発行者
www.xyzcompany.com
のトークン属性ルールを作成して、信頼できる発行者ドキュメントmyTrustDocument
に追加します:curl -i -X POST -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule
例
curl -i -X POST -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule
「TokenAttributeRuleの作成」を参照してください。
次に、単一のトークン属性ルールを指定したリクエスト本文の例を示します。
[ { "issuername": "www.xyzcompany.com", "nameid": { "nameidAttribute": "nameidattr1", "mapping": { "userAttribute": "userAttr1", "userMappingAttribute": "userMappingAttr1" }, "filter": [ "filter1", "filter2" ] }, "virtualuser": { "enabled": "true", "defaultRoles": [ "defaultRole1", "defaultRole2" ], "tokenRoleAttributes": [ "roleAttr1", "roleAttr2" ], "tokenRoleMappings": [ { "tokenRole": "tokenRole1", "mappingRoles": [ "mappingRole1", "mappingRole2" ] } ] }, "attributes": [ { "name": "attr1", "mapping": { "userAttribute": "userAttr1", "userMappingAttribute": "userMappingAttr1" }, "filter": [ "filter11", "filter12" ] }, { "name": "attr2", "filter": [ "filter21", "filter22" ] } ] } ]
次にリクエストの成功を示すレスポンスの例を示します。
{ "STATUSCODE": "20101", "MESSAGE": "TokenAttributeRule \"[identifier:null, issuername:www.xyzcompany.com]\" are successfully created." }
issuername
およびidentifier
の問合せパラメータを指定して、特定のトークン属性ルールの詳細を表示します:curl -i -X GET -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule?issuername={IssuerName}&identifier={Identifier}
例
curl -i -X GET -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule?issuername=www.abccompany.com&identifier=myidentifier1
「TokenAttributeRuleの取得」を参照してください。
次に、レスポンス本文の例を示します:
[ { "issuername": "www.abccompany.com", "identifier": "myidentifier1" } ]
issuername
の問合せパラメータを指定して、発行者www.xyzcompany.com
の詳細を表示します:curl -i -X GET -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule?issuername={IssuerName}&identifier={Identifier}
例
curl -i -X GET -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule?issuername=www.xyzcompany.com
「TokenAttributeRuleの取得」を参照してください。
次に、レスポンス本文の例を示します:
[ { "issuername": "www.xyzcompany.com", "nameid": { "mapping": { "userAttribute": "userAttr1", "userMappingAttribute": "userMappingAttr1" }, "filter": [ "filter1", "filter2" ], "nameidAttribute": "nameidattr1" }, "virtualuser": { "enabled": "true", "defaultRoles": [ "defaultRole1", "defaultRole2" ], "tokenRoleAttributes": [ "roleAttr1", "roleAttr2" ], "tokenRoleMappings": [ { "tokenRole": "tokenRole1", "mappingRoles": [ "mappingRole1", "mappingRole2" ] } ] }, "attributes": [ { "name": "attr1", "mapping": { "userAttribute": "userAttr1", "userMappingAttribute": "userMappingAttr1" }, "filter": [ "filter11", "filter12" ] }, { "name": "attr2", "filter": [ "filter21", "filter22" ] } ] } ]
- オプションで、
issuername
の問合せパラメータを指定して、リポジトリからwww.xyzcompany.com
の属性ルールを削除します:curl -i -X DELETE -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule?issuername={IssuerName}&identifier={Identifier}
例
curl -i -X DELETE -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule?issuername=www.xyzcompany.com
「TokenAttributeRuleの削除」を参照してください。
次にリクエストの成功を示すレスポンスの例を示します。
{ "STATUSCODE": "20104", "MESSAGE": "Following TokenAttributeRule(s) are successfully deleted: [identifier:null, issuername:www.xyzcompany.com]" }
- オプションで、次のコマンドを実行して、信頼できる発行者ドキュメント
myTrustDocument
のすべてのトークン属性ルールをリポジトリから削除します:curl -i -X DELETE -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule
例
curl -i -X DELETE -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule
「TokenAttributeRuleの削除」を参照してください。
次にリクエストの成功を示すレスポンスの例を示します。
{ "STATUSCODE": "20104", "MESSAGE": "Following TokenAttributeRule(s) are successfully deleted: [identifier:myidentifier1, issuername:www.abccompany.com, identifier:null, issuername:www.testcompany.com]" }