Knowledge Discovery 25.1
Document Security Administration Guide

# Security through the Java ACI API NG

This section contains example code that demonstrates how to use the Java ACI API NG to obtain a `securityinfo` string for a user and perform queries against Knowledge Discovery.

The sample code makes the following assumptions:

- The Knowledge Discovery components have been deployed in a Kerberos environment.
- You have configured your JVM to work in a Kerberos environment. For information about how to do this, refer to the Java documentation, for example: http://docs.oracle.com/javase/7/docs/technotes/guides/security/.
- The sample code requests the details required, for example a user name and the query text, on the command line. You can modify this so that the information is obtained in a suitable way.

The sample code first creates an `AciService` to use for communicating with Knowledge Discovery components. For more information about creating an ACI service, refer to the ACI API Programming Guide.

        // Create the AciService to use when communicating with IDOL...
        final AciService aciService = new AciServiceImpl(
                new GssAciHttpClientImpl(new HttpClientFactory().createInstance()),
                new GssAciServerDetails(serviceName, host, port)
        );

The sample code then obtains a `securityinfo` string:

       final Document document = aciService.executeAction(
                new AciParameters(
                      new AciParameter(AciConstants.PARAM_ACTION, "UserRead"),
                      new AciParameter("UserName", userName),
                      new AciParameter("SecurityInfo", true)
                ),
                new DocumentProcessor()
        );

After extracting the `securityinfo` string from the XML response, the sample code then sends a query to the Content component:

       final Document results = aciService.executeAction(
              new AciParameters(
                     new AciParameter(AciConstants.PARAM_ACTION, "Query"),
                     new AciParameter("Text", queryText),
                     new AciParameter("combine", "simple"),
                     new AciParameter("maxResults", 10),
                     new AciParameter("totalResults", true),
                     new AciParameter("print", "none"),
                     new AciParameter("summary", "ParagraphConcept"),
                     new AciParameter("characters", 400),
                     new AciParameter("anyLanguage", true),
                     new AciParameter("outputEncoding", "utf8"),
                     new AciParameter("SecurityInfo", securityInfo)
              ),
              new DocumentProcessor()
        );

The sample code prints information about the result documents to the command line. You can modify this to suit your requirements.

Copyright 2024 Open Text
Version 25.1 | Last updated January 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery 25.1

Topic Title: Security through the Java ACI API NG