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.
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 Eclipse.app 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.
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.
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.
Hi Jagan,Unfortunately it is not possible to share it as an attachment. The forum software don't allow jar files.I can sent it to you as PM.
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!
Could you please provide me the latest the plug-in jar that supports ca-apigateway 9.3 version ?
Could you send me the eclipse plugin as well ?
You might want to put it on a Github or some sort to avoid to send PM to everyone ! :)
Thanks in advance