Layer7 API Management

Expand all | Collapse all

Examples of custom assertions

Jump to Best Answer
  • 1.  Examples of custom assertions

    Posted 11-13-2015 10:00 AM

    We want to create some custom assertions with input and output parameters for the api gateway. Does anybody want to share some samples of custom assertions? With some examples we could kickstart our own custom assertions.

  • 2.  Re: Examples of custom assertions
    Best Answer

    Posted 11-18-2015 07:33 AM

    Hello, Edward. You may find the attached Custom Assertion project plugin for Eclipse useful.


    Note: This plugin is not a supported CA product. It was developed by the community. Use at your own risk, and post questions here, and don't contact CA support for questions or issues related to the use of this plugin.


    Use this plugin by adding it to your Eclipse dropins folder. This can be easier to find on some platforms than on others. On Mac, you'll find it in your directory:



    Start (or restart, if already running) Eclipse, and create a new project:



    Under the CA API Management category, select CA API Management Custom Assertion Project, and click Next:



    Make changes to fields in the form to accelerate creation of a unique custom assertion and/or click the Finish button:



    This will result in a custom assertion project that is ready to be built with Ant, and that demonstrates taking two strings as input, converting both to upper case and concatenating them together, and returning the result in an output context variable:



    The project will use your workspace's default JRE:



    For custom assertions that will be run on v8.4 or above gateways, you must use a Java 8 (a.k.a. 1.8) version. For custom assertions that will be run on v8.0 to v8.3, you must use a Java 7 (a.k.a. 1.7) version of Java. This change can be made to in your project's Java Build Path settings. For earlier version of the gateway, you should use an earlier version of the plugin (not attached, but can attach upon request).


    Build your project by selecting the build.xml file in the project's root directory, right click to open its context menu, select Run As, and Ant Build:


    This will result in a corresponding .jar file in a build folder in the project's root directory:

    Deploy the .jar file to your gateway's /opt/SecureSpan/Gateway/runtime/modules/lib file and change its ownership to layer7:layer7, then restart your gateway. Your custom assertion should now be available in the policy assertion pallet.

  • 3.  Re: Examples of custom assertions

    Posted 11-18-2015 07:39 AM

    BTW, I should add that though it's great to see your interest in extending the gateway's capabilities using custom assertions, in almost all cases, it's possible and possibly better to use policy (and possibly policy backed encapsulated assertions in later versions of the gateway). In the many years I've been with Layer 7 and now CA, I can probably count on two hands the times that a custom assertion was needed to solve a problem, and for most of those cases, we now have out-of-the-box policy assertions that can solve the same problem without a custom assertion.

  • 4.  Re: Examples of custom assertions

    Posted 07-12-2018 05:03 AM

    My colleague Lucas has recently developed a Custom Assertion for us. He wrote a nice how to: Implementation of a CA API Gateway Custom Assertion. If you are interested in starting to develop a Custom Assertion you might like to consider this tutorial.

  • 5.  RE: Re: Examples of custom assertions

    Posted 07-16-2019 11:36 AM
    The attachment to your message can't be found anymore : where can I found the Custom Assertion project plugin for Eclipse now ?

    Thanks in advance.

  • 6.  RE: Re: Examples of custom assertions

    Posted 07-17-2019 08:37 AM
    It seems to be gone with the migration to Broadcom. 
    See attached the jar File from the original post.

  • 7.  RE: Re: Examples of custom assertions

    Posted 07-17-2019 09:04 AM
    Edited by Nicolas Mayoraz 07-17-2019 09:06 AM
    Hi Waldemar, 

    Actually there is no attachment with the original post either:

    And nothing is attached to your reply.

    Could you add the file as attachment to a new message ?


  • 8.  Re: Examples of custom assertions

    Posted 12-10-2015 10:00 AM

    Hello. Was Ben's response adequate to addressing your question? If so then please take a moment to mark it as the best answer. Thanks!

  • 9.  Re: Examples of custom assertions

    Posted 01-25-2019 03:47 PM

    Could you please provide me the latest the plug-in jar that supports ca-apigateway 9.3 version ?