Installation
You can learn how to install the Java Enforcer with this article.
The Java Enforcer is published as two Maven artifacts. Both share the same version number and public API (com.perimeterx.*); choose the artifact that matches your servlet namespace and application server.
Prerequisites
- JDK: There are different JDK requirements depending on the artifact:
perimeterx-sdk(javax): JDK 1.7 or higherperimeterx-sdk-jakarta: JDK 17 or higher (required by Jakarta Servlet 6/Spring Boot 3).
- If you are using a Java version earlier than 8u161, you may need to install the JCE Unlimited Strength Policy files to enable unlimited strength cryptography. If you don’t do this, you may see
Unlimited Strength Jurisdiction Policyerrors on startup. This is enabled by default in Java version 9 and later. - Your unique HUMAN information:
- Your Application ID. You can find this under Platform Settings > Applications > Overview in the HUMAN console. If you have multiple environments, you will also have multiple Application IDs, so be sure to choose the correct ID for the environment you want to install on.
- Your Server Token. You can find this under Platform Settings > Applications, then selecting an application and navigating to Application settings > Server token.
- Your Risk Cookie Key. You can find this under Bot Defender > Policies > Policy Settings > Policy Information.
Installation
Java EE (javax.servlet)
Jakarta EE (jakarta.servlet)
Use this artifact for Spring Boot 2.x, Tomcat 9 and earlier, and other stacks that still use the javax.servlet namespace.
Integrate the Enforcer as a Servlet Filter
Create a filter that intercepts all incoming requests and verifies them with HUMAN. Be sure to include your HUMAN Application ID, Server Token, and Cookie Key.
You only need to include the responseWrapper section found at the end of the code example if you use Credentials Intelligence.
Servlet version >= 3.0
Servlet version < 3.0
Integration example