UserRegistry Attribute Reader Enhancement and Jandex Index Format Support Update in 26.0.0.3
This release introduces UserRegistry Attribute Reader APIs for retrieving user attributes from LDAP and custom registries, and adds support for Jandex index formats 11-13 to improve application startup performance.
In Open Liberty 26.0.0.3:
View the list of fixed bugs in 26.0.0.3.
Check out previous Open Liberty GA release blog posts.
Develop and run your apps using 26.0.0.3
If you’re using Maven, include the following in your pom.xml file:
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.12.0</version>
</plugin>
Or for Gradle, include the following in your build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.openliberty.tools:liberty-gradle-plugin:4.0.0'
}
}
apply plugin: 'liberty'
Or if you’re using container images:
FROM icr.io/appcafe/open-liberty
Or take a look at our Downloads page.
If you’re using IntelliJ IDEA, Visual Studio Code or Eclipse IDE, you can also take advantage of our open source Liberty developer tools to enable effective development, testing, debugging and application management all from within your IDE.
UserRegistry Attribute Reader Enhancement
The UserRegistry API provides applications with the ability to retrieve specific user attributes and search for users based on attribute values directly from LDAP and custom user registries.
What’s New?
Previously, the UserRegistry API supported only basic user lookups such as searching by userSecurityName or by using wildcard pattern matching. However, it did not allow applications to retrieve specific user attributes or search for users based on attribute values. These capabilities were available in traditional WebSphere through the VMM API. The introduction of these two new APIs now enables applications to search for users and retrieve attributes from LDAP and custom user registries.
With this enhancement, you can now retrieve specific attributes for a user by using the getAttributesForUser() method. This method supports retrieval of individual attributes such as email or phoneNumber, or "*" to retrieve all available attributes for a user.
You can also search for users based on attribute values by using the getUsersByAttribute() method, enabling applications to locate users by matching specific attribute criteria. These methods are supported for LDAP user registries. Custom user registry implementations can also implement and support these methods.
How to Use It
New API methods added to UserRegistry.java:
-
default Map<String, Object> getAttributesForUser(String userSecurityName, Set<String> attributeNames)Description: Returns a Map<String, Object> containing the specified
attributesNamesand their corresponding values for the givenuserSecurityName, as configured in the LDAP user registry.UserRegistry ur = RegistryHelper.getUserRegistry("realmName"); // valid ldap attribute names Set<String> attributeNames = Set.of("telephoneNumber", "uid", "mail"); // or "*" for retrieving all attributes Map<String, Object> result = ur.getAttributesForUser("testuser", attributeNames); // output in trace.log > getAttributesForUser Entry testuser [telephoneNumber, uid, mail] < getAttributesForUser Exit {uid=testuser, mail=testuser@example.com, telephoneNumber=<telephone-number>} -
default SearchResult getUsersByAttribute(String attributeName, String value, int limit)Description: Returns a
SearchResultobject that contains a list of users that match anattributeNamewith specifiedvaluethat is configured in the LDAP user registry.UserRegistry ur = RegistryHelper.getUserRegistry("realmName"); SearchResult searchResult = ur.getUsersByAttribute("email", "[email protected]", 1); // output in trace.log > getUsersByAttribute Entry email testuser@example.com 1 < getUsersByAttribute Exit SearchResult hasMore=false [testuser]
To learn more about the user registry, see the following resources:
Jandex Index Format Support Update
Open Liberty now supports the latest Jandex index formats, allowing the use of Jandex indexes that are created with Jandex version 3.1.0 and later. Jandex is a space‑efficient Java annotation indexer and offline reflection library that improves application startup performance by pre‑indexing class metadata.
This feature targets application developers and DevOps engineers who work with Jakarta EE and MicroProfile applications. It is designed to optimize application startup times and reduce runtime costs.
What’s New?
With this update, Open Liberty supports Jandex index formats 11, 12, and 13. Jandex versions 3.1.0 through the current latest version, 3.5.3, generate indexes that use these formats.
Previously, Open Liberty supported Jandex index format versions only up to and including version 10. This index format limitation meant that applications packaged with Jandex indexes could not use index formats beyond version 10 while retaining the expected performance improvements. To preserve these performance benefits, build tooling had to continue using a Jandex version prior to 3.1.0, or explicitly configure Jandex index generation to produce indexes that use index format up to and including version 10.
Benefits
The added support for Jandex index formats has several benefits:
-
Improved Compatibility: Works seamlessly with the latest versions of build tools and frameworks that use newer Jandex versions
-
Faster Startup Times: Continue to benefit from Jandex’s efficient annotation indexing without version constraints
-
Reduced Maintenance: No need to maintain multiple Jandex versions or regenerate indexes for compatibility
-
Future-Proof: Stay current with the Jandex ecosystem as it evolves
Limitations
When using Jandex indexes, ensure that the index files are kept up to date with the application classes. If a Jandex index is not synchronized with the application classes, it can contain incorrect annotation data, which can cause the application to function incorrectly. Out‑of‑date Jandex indexes cannot be reliably detected.
Open Liberty does not read index formats higher than index format 13. If a new version of Jandex adds a higher index format version, Open Liberty requires an update before it can read Jandex indexes that use the higher index format version.
The Open Liberty feature mpGraphQL, which is obtained from an external source, is limited to reading Jandex index formats no higher than index format 10. If the feature mpGraphQL is used, Jandex indexes should be generated by using index format 10. This limitation applies to all current versions of mpGraphQL, including the current highest version, mpGraphQL-2.0.
Lifting Restriction
Previously, when Jandex usage was enabled and an application included Jandex indexes that used formats 11 through 13, Open Liberty displayed an error message and ignored those indexes. In such cases, annotation scanning was performed by using Liberty’s internal annotation scanning mechanism.
With the addition of support for Jandex index formats 11 through 13, Open Liberty now uses indexes that are generated in these formats. These indexes must be kept up to date with the application classes. Ensure that the Jandex indexes packaged with your application accurately reflect the current application classes.
How to Use
No configuration changes are required in the server.xml file to enable support for the new Jandex index formats. Open Liberty automatically detects the Jandex index format and selects the appropriate index reader for that format. It reads indexes that use formats 11, 12, and 13, and continues to support indexes that use format up to version 10.
By default, Jandex usage is disabled. To enable Jandex, set the useJandex property to true in either an application element or the applicationManager element.
If you are generating Jandex indexes as part of your build process, you can now use the latest Jandex Maven plugin or Gradle plugin versions:
Maven Example:
<plugin>
<groupId>io.smallrye</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<id>make-index</id>
<goals>
<goal>jandex</goal>
</goals>
</execution>
</executions>
</plugin>
Gradle Example:
plugins {
id 'org.kordamp.gradle.jandex' version '2.3.0'
}
Open Liberty automatically detects and recognizes the generated META-INF/jandex.idx file for any supported index format version.
For more information, see the Jandex Documentation
Notable bugs fixed in this release
We’ve spent some time fixing bugs. The following sections describe some of the issues resolved in this release. If you’re interested, here’s the full list of bugs fixed in 26.0.0.3.
Get Open Liberty 26.0.0.3 now
Available through Maven, Gradle, Docker, and as a downloadable archive.