Configure the Token Attributes

You can view and manage the token attributes for the token attribute rules using the Token Attribute Rule REST API.

The cURL command examples use the URL structure:
http://host:port/wsm-pmrest/v2/trust/{aTrustDocName}/attributerule/{issuername}/{identifier}/attribute

The following use case shows you how to:

  • Create a token attributes

  • View a token attribute

  • Modify a token attribute

  • Delete a token attribute

To manage the token attributes using the Token Attribute Rules Rest API:

  1. Specify the headers on the cURL command line:
    -H Accept:application/json
  2. Create two token attributes attr1 and attr2 for the token attribute rule (Identifier myidentifier1 and Issuer Name www.abccompany.com) to the trusted issuer document myTrustDocument by running the following command:
    curl -i -X POST -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule/{issuername}/{identifier}/attribute

    See Create TokenAttribute(s).

    Example

    curl -i -X POST -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/www.abccompany.com/myidentifier1/attribute
    The following shows an example of the request body:
    [
      {
        "name": "attr1" },
      {
        "name": "attr2",
        "mapping": {
          "userAttribute": "userAttr2",
          "userMappingAttribute": "userMappingAttr2"
        },
        "filter": [
          "filter1",
          "filter2"
        ]
      }
    ]

    The following shows an example of the response indicating the request succeeded.

    {
      "STATUSCODE": "20111",
      "MESSAGE": "Attribute \"[name:attr1, name:attr2]\" are successfully created."
    }

    Note:

    To map the use attributes for the token attribute, see Map User Attributes for the Token Attributes
  3. Change the filter names to Newfilter1 and Newfilter2 for the attr2 token attribute by running the following command:
    curl -i -X PATCH -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule/{issuername}/{identifier}/attribute

    Example

    curl -i -X PATCH -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/www.abccompany.com/myidentifier1/attribute

    See Update TokenAttribute(s).

    The following shows an example of the request body.

    [
      {
        "name": "attr2",
        "filter": [
          "newfilter1",
          "newfilter2"
        ]
      }
    ]

    The following shows an example of the response indicating the request succeeded.

    {
      "STATUSCODE": "20112",
      "MESSAGE": "Attribute \"[name:attr2]\" are successfully updated."
    }
  4. View all the token attributes for the token attribute rule in the repository by running the following command:
    curl -i -X GET -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule/{issuername}/{identifier}/attribute

    Example

    curl -i -X GET -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/www.abccompany.com/myidentifier1/attribute

    See Get TokenAttribute(s).

    The following shows an example of the response indicating the request succeeded.

    [
      {
        "name": "attr1"
      },
      {
        "name": "attr2",
        "mapping": {
          "userAttribute": "userAttr2",
          "userMappingAttribute": "userMappingAttr2"
        },
        "filter": [
          "newfilter1",
          "newfilter2"
        ]
      }
    ]
  5. View a specific token attribute for the token attribute rule by specifying the name query parameters:
    curl -i -X GET -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule/{issuername}/{identifier}/attribute?name={AttributeName}

    Example

    curl -i -X GET -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/www.abccompany.com/myidentifier1/attribute?name=attr2

    See Get TokenAttribute(s).

    The following shows an example of the response indicating the request succeeded.

    [
      {
        "name": "attr2",
        "mapping": {
          "userAttribute": "userAttr2",
          "userMappingAttribute": "userMappingAttr2"
        },
        "filter": [
          "newfilter1",
          "newfilter2"
        ]
      }
    ]
  6. Optionally, delete the attr2 token attribute by running the following command:
    curl -i -X DELETE -u username:password -H Content-type:application/json http://host:port/wsm-pmrest/v2/trust/{trustname}/attributerule/{issuername}/{identifier}/attribute?name={AttributeName}

    Example

    curl -i -X DELETE -u Smith:Password -H Content-type:application/json http://myhost:7001/wsm-pmrest/v2/trust/myTrustDocument/attributerule/www.abccompany.com/myidentifier1/attribute?name=attr2

    See Delete TokenAttribute(s).

    The following shows an example of the response indicating the request succeeded.

    {
      "STATUSCODE": "20114",
      "MESSAGE": "Following Attribute(s) are successfully deleted: [name:attr2] "
    }