Example Four: Matching and Target Roles
An application can temporarily add some of its users to a set of roles using matching and target roles. If the user is a member of the matching role when entering the application, the application adds the user to the target roles. When users exit the application, they lose their membership in the target roles.
The following example demonstrates creating a matching role and target role for the /csp/user application.
Open the /csp/user web application definition.
Click the Matching Roles tab. Then do the following:
Select SecurityTutorialRole from the Select a matching role drop down list. Select a role from the Available column on the left of the form, for example, %Developer.
Click the arrow in the middle. This displays the role on the Selected column on the right.
Click the Assign button.
The top half of the interface shows SecurityTutorialRole as a matching role and %Developer as the target role.
Execute the GET request again, still using the JSmith credentials. You will see that %Developer has been added to the set of roles.
If a user is already a member of a target role before entering the application, then the application does not assign the user to any new roles and does not remove the user from any roles.