- REST API for Oracle Web Services ManagerREST API for Oracle Web Services Manager
- Use Cases
- Manage the Token Attribute Rules
- Configure the Token Attributes
Configure the Token Attributes
You can view and manage the token attributes for the token attribute rules using the Token Attribute Rule REST API.
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:
- Specify the headers on the cURL command line:
-H Accept:application/json
- Create two token attributes
attr1
andattr2
for the token attribute rule (Identifiermyidentifier1
and Issuer Namewww.abccompany.com
) to the trusted issuer documentmyTrustDocument
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
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 - Change the filter names to
Newfilter1
andNewfilter2
for theattr2
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
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." }
- 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
The following shows an example of the response indicating the request succeeded.
[ { "name": "attr1" }, { "name": "attr2", "mapping": { "userAttribute": "userAttr2", "userMappingAttribute": "userMappingAttr2" }, "filter": [ "newfilter1", "newfilter2" ] } ]
- 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
The following shows an example of the response indicating the request succeeded.
[ { "name": "attr2", "mapping": { "userAttribute": "userAttr2", "userMappingAttribute": "userMappingAttr2" }, "filter": [ "newfilter1", "newfilter2" ] } ]
- 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
The following shows an example of the response indicating the request succeeded.
{ "STATUSCODE": "20114", "MESSAGE": "Following Attribute(s) are successfully deleted: [name:attr2] " }