简体   繁体   中英

Registering multiple services to a single interface in WSO2 Identity Server

I am trying to find a way to register multiple implementations to a single interface within the OSGI framework. Currently I have an implementation of the UserStoreManager interface which I register in the OSGI framework in the code below.

protected void activate(ComponentContext ctxt) {
    Hashtable<String, String> props = new Hashtable<String, String>();
    CustomUserStoreManager customUserStoreManager = new CustomUserStoreManager();
    ctxt.getBundleContext().registerService(UserStoreManager.class.getName(), customUserStoreManager, props);
}

The problem is that there is already another implementation of the UserStoreManager interface which I can't remove.

How do I register my implementation in such a way that it won't cause issues with the other implementation?

I read about providing properties and how that can be used to solve this problem, however I do not believe that the properties I provide are being picked up by WSO2's Identity Server.

Both of the implementations of the UserStoreManager interface are used as secondary user stores within the identity server.

Thank you.

There is no need to remove the existing UserStoreManager implementation. If you want to use your new customized UserStoreManager for the primary user store, replace the UserStoreManager class in the user-mgt.xml file and restart the server. Then this com.custom.user.manager.CustomCUserStoreManager will be used.

<UserStoreManager class="com.custom.user.manager.CustomUserStoreManager">

If you want to change it for secondary user store change the class name in the edit secondary user store in the management console.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM