First Party Configuration

In First Party Mode, the HUMAN Java SDK acts as a reverse proxy for client requests and sensor activity.

The HUMAN Java SDK is configured with First-Party mode enabled by default.

To confirm that you have configured your HUMAN Java SDK in First-Party mode, review the HUMAN details in your application configuration.

First Party Enabled Example (default value)

Below is an example configuration HUMAN Java SDK:

// Create configuration object
PXConfiguration pxConfiguration = new PXConfiguration.Builder()
     .cookieKey(COOKIE_KEY)
     .authToken(AUTH_TOKEN)
     .appId(APP_ID)
     .blockingScore(SCORE)
     .moduleMode(ModuleMode.BLOCKING)
     .build();

// Get instance
PerimeterX enforcer = new PerimeterX(pxConfiguration);

// Inside the request / Filter
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOExcption {
...
    PXContext ctx = enforcer.pxVerify(req, new HttpServletResponseWrapper(resp);
    if (ctx != null && !ctx.isHandledResponse()) {
       // request should be blocked and BlockHandler was triggered on HttpServerResponseWrapper
    }
...
}

First Party Mode Disabled Example

Below is an example configuration HUMAN Java SDK:

The presence of the firstPartyEnabled with a value of false confirms that the default configuration has been changed and First-Party mode is disabled.

// Create configuration object
PXConfiguration pxConfiguration = new PXConfiguration.Builder()
     .cookieKey(COOKIE_KEY)
     .authToken(AUTH_TOKEN)
     .appId(APP_ID)
     .blockingScore(SCORE)
     .moduleMode(ModuleMode.BLOCKING)
     .firstPartyEnabled(false)
     .build();

// Get instance
PerimeterX enforcer = new PerimeterX(pxConfiguration);

// Inside the request / Filter
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOExcption {
...
    PXContext ctx = enforcer.pxVerify(req, new HttpServletResponseWrapper(resp);
    if (ctx != null && !ctx.isHandledResponse()) {
       // request should be blocked and BlockHandler was triggered on HttpServerResponseWrapper
    }
...
}

In order to enable First Party Mode, you need to set the firstPartyEnabled to true and recompile your application and continue to the Additional Routes below.

Additional Routes (Optional)[

If you have implemented the Java SDK on all routes of your application, you can proceed to the Next Steps section of this page. If you implemented the Java SDK only on specific routes, you need to add route below to your application before moving onto the Next Steps.

In First Party mode, sensor calls are made to yourdomain.com/<HUMAN app id without the first 2 letters>/. For example, if your AppID is PX1234567 the path would be `yourdomain/1234567/`. This new route must be added to your application. Once this route has been added, proceed to the Next Steps section.

Next Steps

After configuring the SDK to handle First Party requests, complete the steps listed on the Integrate 1st-Party JS Snippet to confirm your snippet is setup to serve the Javascript Sensor via First-Party.