ロール・マッピングの管理

トークン属性ルールREST APIを使用して、仮想ユーザーのロール・マッピングを表示および管理できます。

cURLコマンドの例では、URL構造を使用しています:
http://host:port/wsm-pmrest/v2/trust/{aTrustDocName}/attributerule/{anIssuerName}/{anIdentifier}/virtualuser/rolemapping

次の方法を使用事例で示します。

  • ロール・マッピングの作成

  • ロール・マッピングの表示

  • ロール・マッピングの変更

  • ロール・マッピングの削除

仮想ユーザーのロール・マッピングを管理するには:

  1. cURLコマンド・ラインでヘッダーを指定します。
    -H Accept:application/json
  2. 次のコマンドを実行して、仮想ユーザーのロール・マッピングおよびロール属性を設定します:
    curl -i -X POST -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustdocumentName}/attributerule/{issuername}/{identifier}/virtualuser/rolemapping

    curl -i -X POST -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/myIssuer1/myidentifier1/virtualuser/rolemapping

    「TokenRoleMappingの作成」を参照してください。

    次に、リクエスト本文の例を示します。
    [
      {
        "tokenRole": "tokenRole1",
        "mappingRoles": [
          "mappingRole11",
          "mappingRole12"
        ]
      }
    ]

    次にリクエストの成功を示すレスポンスの例を示します。

    { "STATUSCODE": "20131", "MESSAGE": "RoleMapping \"[tokenRole:tokenRole1]\" are successfully created." }
  3. 次のコマンドを実行して、仮想ユーザーのマッピング・ロール(mappingRole1およびmappingRole2)をmanagerおよびexecuterに変更します:
    curl -i -X PATCH -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustdocumentName}/attributerule/{issuername}/{identifier}/virtualuser/rolemapping

    curl -i -X PATCH -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/myIssuer1/myidentifier1/virtualuser/rolemapping

    「TokenRoleMappingの更新」を参照してください。

    次に、リクエスト本文の例を示します:
    [
      {
        "tokenRole": "tokenRole1",
        "mappingRoles": [
          "manager",
          "executer"
        ]
      }
    ]

    次にリクエストの成功を示すレスポンスの例を示します。

    {
        "STATUSCODE": "20132",
        "MESSAGE": "RoleMapping \"[tokenRole:tokenRole1]\" are successfully updated."
    }
  4. 次のコマンドを実行して、仮想ユーザーのロール・マッピングを表示します:
    curl -i -X GET -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustdocumentName}/attributerule/{issuername}/{identifier}/virtualuser/rolemapping

    curl -i -X GET -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/myIssuer1/myidentifier1/virtualuser/rolemapping

    「TokenRoleMappingの取得」を参照してください。

    次にリクエストの成功を示すレスポンスの例を示します。

    [
      {
        "tokenRole": "tokenRole1",
        "mappingRoles": [
          "manager",
          "executer"
        ]
      }
    ]
  5. オプションで、次のコマンドを実行して、仮想ユーザーのロール・マッピングを削除します:
    curl -i -X DELETE -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustdocumentName}/attributerule/{issuername}/{identifier}/virtualuser/rolemapping

    curl -i -X DELETE -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/myIssuer1/myidentifier1/virtualuser/rolemapping

    「TokenRoleMappingの削除」を参照してください。

    次にリクエストの成功を示すレスポンスの例を示します。

    {
      "STATUSCODE": "20134",
      "MESSAGE": "RoleMapping \"[tokenRole:tokenRole1]\" are successfully deleted"
    }