IDOL 12.13

# 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 IDOL.

The sample code makes the following assumptions:

- The IDOL Server has 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 IDOL Server. For more information about creating an ACI service, refer to the ACI API Programming Guide.

        // Create the AciService to use when communicating with IDOL Server...
        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 IDOL:

       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 2022 Micro Focus or one of its affiliates
Version 12.13 | Last updated October 2022

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 swpdl.idoldocsfeedback@microfocus.com.

We appreciate your feedback!

Product: IDOL 12.13

Topic Title: Security through the Java ACI API NG