You can develop a custom thread identity service class by implementing the
com.ibm.wsspi.kernel.security.thread.ThreadIdentityService interface that is
provided in the Liberty server. The
ThreadIdentityService interface is a Service Programming Interface (SPI) that
enables support to receive notifications of user identity switches.
Procedure
- Create a custom thread identity service by implementing the
ThreadIdentityService interface.
- Convert the implementation class into an OSGi service. You can do the conversion in either of two ways:
- Convert your ThreadIdentityService class into a Declarative
Service (DS) component. For more information, see Declaring your services to OSGi Declarative Services.
- Write a new ThreadIdentityService class that is a DS
component and delegate it to your ThreadIdentityService
class. Register your ThreadIdentityService class
directly in the Service Registry (SR) by using the OSGi core APIs. For more information, see Working with the OSGi service registry.
- Package the custom thread identity service as an OSGi bundle and export the
ThreadIdentityService service. For information on creating an OSGi bundle, see .
- Create a feature manifest to include the OSGi bundle. For more information, see Product extension.
- After the feature is installed into the user product extension location, configure the
server.xml file with the feature name.
<featureManager>
...
<feature>usr:sampleThreadIdentityService-1.0</feature>
</featureManager>