How to configure your preferred user stores to authenticate users

  1. The user provides the user name with the user store domain (eg: PRIMARY/peter). Then WSO2 IS validate username and password against the values stored in the PRIMARY user store.
  2. The user provides only the username without specifying the user store domain (eg: peter). Then, WSO2 IS starts to authenticate the user starting from the PRIMARY user store. If one user store fails to authenticate the user even if there is the username(i.e password is not matching), authentication will be executed in chained UserStoreManagers recursively.
  1. Implement ​ UserStorePreferenceOrderSupplier ​ interface with your own logic to retrieve the allowed user stores.
  1. CustomUserStoreOrderCallbackFactory class extends CallBackHandlerFactory.
  2. SimpleUserStoreOrderCallbackHandler implements UserStorePreferenceOrderSupplier<List<String>>.
  3. RegistryBasedUserStoreOrderCallbackHandler extends SimpleUserStoreOrderCallbackHandler.
  4. Logic: Users who are in PRIMARY, MANAGER, and DRIVER user stores can log in to travelocity.com service provider. This
    configuration is read from Registry.
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.application.authentication.framework</artifactId>
<version>5.14.97</version>
</dependency>
<carbon.kernel.package.import.version.range>[4.4.0, 5.0.0)</carbon.kernel.package.import.version.range>
  1. Build the repo which contains the login using mvn clean install command.
  2. Inside target folder, you will find org.wso2.carbon.identity.custom.callback.userstore-1.0-SNAPSHOT.jar
  3. Copy and paste the generated jar file
    “​ org.wso2.carbon.identity.custom.callback.userstore-1.0-SNAPSHOT.jar”
    into​ <IS-HOME>/repository/components/dropins/
  4. Configure the extended CallBackHandlerFactory in
    <IS-HOME>/repository/conf/identity/application-authentication.xml file, under
<ApplicationAuthentication xmlns=”​ http://wso2.org/projects/carbon/application-authentication.xml​ “>
<Extensions>

<CallbackFactory>org.wso2.carbon.identity.custom.callback.userstore.CustomUserStoreOrderCallbackFactor
y</CallbackFactory>

</Extensions>
[authentication.framework.extensions]
callback_factory = “org.wso2.carbon.identity.custom.callback.userstore.CustomUserStoreOrderCallbackFactory”

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Anuradha Karunarathna

Anuradha Karunarathna

Senior Software Engineer@ WSO2 | Computer Science and Engineering graduate@ University of Moratuwa, SriLanka