org.wso2.carbon.identity.userstore.mongodb:identity-userstore-mongodb

MongoDB user store extension

License

License

Categories

Categories

IDE Development Tools MongoDB Data Databases
GroupId

GroupId

org.wso2.carbon.identity.userstore.mongodb
ArtifactId

ArtifactId

identity-userstore-mongodb
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

bundle
Description

Description

MongoDB user store extension
Project URL

Project URL

http://wso2.org
Project Organization

Project Organization

WSO2
Source Code Management

Source Code Management

https://github.com/wso2-extensions/identity-userstore-mongodb.git

Download identity-userstore-mongodb

Dependencies

compile (7)

Group / Artifact Type Version
org.wso2.carbon : org.wso2.carbon.user.core jar 4.4.26
org.wso2.carbon : org.wso2.carbon.user.api jar 4.4.26
org.json : json jar 20180130
commons-logging : commons-logging jar 1.2
org.jasypt : jasypt jar 1.9.2
org.mongodb : mongo-java-driver jar 3.7.1
org.apache.felix : org.apache.felix.scr.ds-annotations jar 1.2.8

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

MongoDB User Store Extension for WSO2 IS

Introduction

This is an extension, which consists of a user store implemented using MongoDB (A NoSQL Database) for WSO2 Product-IS. This MongoDB user store extension can be used as both primary and secondary user store for product-IS. This extension is compatible with IS version 5.5.0.

Prerequisites

Steps to Configure

  1. First, build the MongoDB user store extension using maven by executing the following command from the root folder of this extension
   mvn clean install    
  1. Copy the extension jar file created inside the target folder and add it into the /repository/components/dropins folder of product-IS

  2. Copy the MongoDB-Java-driver jar into the /repository/components/lib folder of product-IS

  3. start the MongoDB server using the following command

   sudo service mongod start  
  1. Start a Mongo shell using the below command
   mongo --host 127.0.0.1:27017
  1. Create a database named wso2_carbon_db by entering the following command in the Mongo shell
   use wso2_carbon_db
  1. Create the necessary collections by running the MongoDB script file user_mgt_collections.js provided by executing the following command in the Mongo shell
   load(<PATH_TO_THE_SCRIPT_FILE>)
  1. Finally, open a terminal, navigate to the bin folder of product-IS and start the IS server by executing the following command
   ./wso2server.sh

Now you have successfully added the mongoDB user store extension to the product-IS. You should see MongoDB user store listed along with other user stores using which you can create a MonogDB secondary user store and started using it for your user management operations.

Configuring MongoDB as the Primary User Store

The above configurations are good enough for you to use the MongoDB as a secondary user store manager. However, in order to use the MongoDB as the primary user store of product-IS you require some additional configurations as follow.

  1. After following steps 1-7, prior to start the IS server, add the following in the user-mgt.xml file of product-IS. You can find this file inside /repository/conf folder. Make sure to replace the ConnectionName and ConnectionPassword with your credentials for the specified MongoDB database.
user-mgt.xml
  <UserStoreManager class="org.wso2.carbon.mongodb.user.store.mgt.MongoDBUserStoreManager">
      <Property name="TenantManager">org.wso2.carbon.user.core.tenant.JDBCTenantManager</Property>
      <Property name="ConnectionURL">mongodb://localhost/wso2_carbon_db</Property>
      <Property name="ConnectionName">USERNAME</Property>
      <Property name="ConnectionPassword">PASSWORD</Property>
      <Property name="ReadGroups">true</Property>
      <Property name="ReadOnly">false</Property>
      <Property name="IsEmailUserName">false</Property>
      <Property name="DomainCalculation">default</Property>
      <Property name="WriteGroups">true</Property>
      <Property name="UserNameUniqueAcrossTenants">false</Property>
      <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
      <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
      <Property name="PasswordJavaRegExViolationErrorMsg">Password pattern policy violated.</Property>
      <Property name="UsernameJavaRegEx">^[\S]{5,30}$</Property>
      <Property name="UsernameJavaScriptRegEx">^[\S]{5,30}$</Property>
      <Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated.</Property>
      <Property name="RolenameJavaRegEx">^[\S]{5,30}$</Property>
      <Property name="RolenameJavaScriptRegEx">^[\S]{5,30}$</Property>
      <Property name="validationInterval"/>
      <Property name="CaseInsensitiveUsername">true</Property>
      <Property name="SCIMEnabled">false</Property>
      <Property name="IsBulkImportSupported">false</Property>
      <Property name="PasswordDigest">SHA-256</Property>
      <Property name="MultiAttributeSeparator">,</Property>
      <Property name="StoreSaltedPassword">true</Property>
      <Property name="MaximumUserListLength">100</Property>
      <Property name="MaximumRoleListLength">100</Property>
      <Property name="EnableUserRoleCache">true</Property>
      <Property name="UserNameUniqueAcrossTenants">false</Property>            
  </UserStoreManager>
  1. The format of the ConnectionURL is given below. In case if the port is not specified, then 27017 will be used, which is the default port for MongoDB.
   mongodb://host[:port]/database[?options]
  1. Comment the existing primary user store xml configurations in user-mgt.xml and save the file.

  2. Now, open a terminal, navigate to the bin folder of product-IS and start the IS server by executing the following command

   ./wso2server.sh

This will start the IS server with MongoDB as the primary user store. Hence, all your user management related tasks will be stored in MongoDB by default.

org.wso2.carbon.identity.userstore.mongodb

WSO2 Extensions

Versions

Version
1.0.0