Create Custom Assertions

Custom Assertions are modules that are added to a gateway to add functionality to be executed in a service policy. They typically implement proprietary business logic, as opposed to standard-compliant mechanisms supported by CA Technologies.
gateway92
Custom Assertions are modules that are added to a
Layer7 API Gateway
to add functionality to be executed in a service policy. They typically implement proprietary business logic, as opposed to standard-compliant mechanisms supported by CA Technologies.
This document describes how to create and install Custom Assertions on a 
Layer7 API Gateway
.
Target Audience
This section is intended for experienced Java developers familiar with the concept of “beans” and how to create Java applications. It also assumes some basic knowledge of the UNIX command line and file permissions and ownership.
The Traffic Logger sample custom assertion requires less Java coding experience. Use it to understand how custom assertions work and how they are implemented in the Gateway.
The Salesforce Connector custom assertion is more detailed and is intended for intermediate to advanced users.
The Custom Assertions API Javadoc provides technical content about the custom assertions application interface, in web format. The Javadoc is packaged within the Custom Assertions SDK and is intended for the experienced Java coder.
Overview
Creating your own custom assertion involves implementing the
com.l7tech.policy.assertion.ext.CustomAssertion
interface and extending the
com.l7tech.policy.assertion.ext.ServiceInvocation
class.
Both of these interfaces and other dependencies are included in the
layer7-api-8.2.0.jar
file, which is located in the Custom Assertion SDK.
  • The class implementing the
    CustomAssertion
    interface uses the bean pattern to describe the data, configured by the administrator in the Policy Manager when the policy is being authored. Adding bean-style getter and setter methods enables these properties to be edited in the Policy Manager.
  • The
    ServiceInvocation
    implementation is instantiated by the 
    Layer7 API Gateway
    and is invoked at policy runtime execution.
When the 
Layer7 API Gateway
instantiates the
ServiceInvocation
implementing class, the
CustomAssertion
implementing object is passed along with the data edited by the administrator.