Cisco Enterprise Policy Manager Java Developers Guide, Release 3.3.2.0
Using PEP Taglib

Table Of Contents

PEP Tag Library Quick Start Guide


PEP Tag Library Quick Start Guide



Note This chapter applies only to JSP applications.


The PEP agent can be deployed easily with a JSP application by using the custom CEPM tags for HTML controls. The following HTML controls can be considered for this purpose:

Text

Text Area

Button

Radio button

Submit button

Checkbox

List box

Label

CEPM()

To enable the PEP tag libraries for your JSP application, follow these steps:


Step 1 Unzip the contents of the CEPM_taglib_v3.3.zip file.

Step 2 Copy the PEP JAR file (pep-v3.3_[YYYYMMDD].jar) into the lib folder of your web application.


Note Note: In pep-v3.3_[YYYYMMDD].jar, the suffix [YYYYMMDD] is a variable name and is the timestamp of the particular PEP release, where: YYYY=Year, MM=Month and DD=Day. Example, PEP JAR having version 3.3 and released on 30th Jan 2010 will have the file name of pep-v3.0_20100130.jar.


Step 3 Copy the cepm.tld file into WEB-INF/tlds folder.

Step 4 Add a reference to cepm-html.tld in the web.xml file as follows:

<taglib> 
<taglib-uri>/WEB-INF/tlds/cepm.tld</taglib-uri> 
<taglib-location>/WEB-INF/tlds/cepm.tld</taglib-location> 
</taglib>

Step 5 Make sure that the pep-config.xml file is available in WEB-INF/classes folder (For instruction on obtaining a pep_config.xml file, refer to Prerequisites.)

Step 6 Specify the taglib uri and prefix in the .JSP file you want to protect:

<%@ taglib uri="/WEB-INF/tlds/cepm.tld" prefix="cepm" %>

Step 7 For HTML controls that you want to protect, pass the following attributes to the tag:

subject (mandatory): user accessing the JSP page

resourceName (mandatory): fully qualified name (FQN) of the resource

action (optional): action name (for example, Read, View, and Edit); if action is not relevant, use default value, any

visible (optional): determine whether or not to show or hide a button on a Deny decision; true or false value

property (mandatory): name of the selected control


Example Usage of the Button Tag

<cepm:button property="button" value="cepm" resource="Fully Qualified Name" visible="true" 
subject="UserName" action="any"/>

When a CEPM tag library is invoked and a request goes to the PDP, the following behavior can be expected:

If the decision is true, the specified control is enabled.

If the decision is false and the visible attribute is set to true, the specified control is disabled (though it can be viewed).

If the decision is false and the visible attribute is set to false, the specified control is not displayed at all.

These steps describe the process of using individual tags to define access permissions (Permit or Deny) for any of the HTML controls included in a JSP. However, if you are defining access permissions for an entire page, a generic CEPM tag can be used instead of defining permissions for each of the individual tags present in the JSP. The following sample code illustrates this scenario.

Sample Code for Using EPM to Protect an Entire JSP Page

<%-- Declaration of tld file specify prefix --%>
<%@ taglib uri="/WEB-INF/tlds/cepm.tld" prefix="cepm" %>
<h2>cepm Tag Testing </h2>
<%--This is starting point of tag. --%>
<cepm:cepm resource="Prime group:Prime portal:Send Trades" user="Mary" action="">
<%-- Body will be rendered depending on the decision --%>
<html>
     <form>
     <body>
     Html body testing
     <br>
     <br>
          <input type="text" name="text" value="Text Testing">
     <br>
     <br>
          <input type="button" name="text" value="Button Testing">
     </form>
     </body>
</html>
<%-- End point of tag --%>
</cepm:cepm>