Skip to content

Conversation

@JayaShakthi97
Copy link
Contributor

@JayaShakthi97 JayaShakthi97 commented Jan 21, 2026

Purpose

Refactor the custom user store manager documentation for IS 7.x products. IS 6.x, IS 5.11, IS 5.10 also need to be updated.

  • Mention UniqueID user store managers as the default ones to be extended.
    • Update method references to UniqueID user store managers methods.
    • Provide an improved categorization of available methods.
    • Update the sample code.
  • Mention the possibility of extending Non-UniqueID user store managers for compatibility.
  • Mention AbstractUserStoreManager as the more advanced usecase.
screencapture-localhost-8000-en-7-1-0-references-extend-user-stores-write-a-custom-user-store-manager-2026-01-21-12_44_41 screencapture-localhost-8000-en-7-1-0-references-extend-user-stores-write-a-custom-user-store-manager-2026-01-21-12_44_41 screencapture-localhost-8000-en-7-1-0-references-extend-user-stores-write-a-custom-user-store-manager-2026-01-21-12_44_41 screencapture-localhost-8000-en-7-1-0-references-extend-user-stores-write-a-custom-user-store-manager-2026-01-21-12_44_41

Related PRs

  • N/A

Test environment

Security checks

Summary by CodeRabbit

  • Documentation
    • Restructured custom user store manager guide with simplified, capability-focused approach
    • Updated code examples and prerequisites to reflect modern patterns
    • Added clearer guidance on base class selection and implementation
    • Introduced new sections for advanced scenarios and legacy compatibility
    • Enhanced deployment workflow with step-by-step instructions

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Walkthrough

This pull request updates a documentation guide for implementing custom user store managers, reorganizing content to emphasize UniqueID-based approaches, modernizing code examples with current dependency versions, updating deployment procedures, and introducing clearer structural guidance for choosing appropriate base classes.

Changes

Cohort / File(s) Summary
Documentation Reorganization & Modernization
en/includes/references/extend/user-stores/write-a-custom-user-store-manager.md
Comprehensive restructure of custom user store manager guide with refocused emphasis on UniqueID user store managers. Reorganized into new sections (Before you begin, Available methods, Implement a custom JDBC user store manager, Deploy and configure, Try out the sample, Advanced topics). Updated code examples with modern patterns, Jasypt-based password encoding, and revised authentication flow references. Modernized prerequisites, Maven/Java version requirements, repository URLs, and dependency versions. Enhanced deployment guidance with updated configuration steps. Replaced exhaustive method tables with capability-centered layout. Removed deprecated content and added explicit guidance for non-UniqueID scenarios and required constructor signatures.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A documentation hop through clearer paths so bright,
UniqueID managers now shimmer in the light,
Code examples dance with modern, fresh refrain,
The guide is reorganized, simplified, and plain!
From user store depths, a better guide takes flight! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description covers purpose and security checks but lacks critical information required by the template. Add test environment details (JDK versions, operating systems, databases, browsers tested) and explain why FindSecurityBugs plugin was not run if applicable.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: refactoring documentation for custom user store managers in IS 7.x.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@en/includes/references/extend/user-stores/write-a-custom-user-store-manager.md`:
- Around line 332-376: The DB resources (Connection from getDBConnection(),
PreparedStatement prepStmt, and ResultSet rs) are not closed and rollback calls
a new getDBConnection(); fix by obtaining the Connection once into a local
variable (e.g., Connection dbConnection = this.getDBConnection()), wrap the
PreparedStatement and ResultSet in try-with-resources (or ensure finally closes
them) and perform rollback/commit on that same local dbConnection instead of
calling getDBConnection() again; ensure dbConnection is closed in a finally
block (or try-with-resources) after commit/rollback and adjust the
authentication logic around these resources (references: getDBConnection,
dbConnection, prepStmt, rs, passwordEncryptor.checkPassword).
🧹 Nitpick comments (1)
en/includes/references/extend/user-stores/write-a-custom-user-store-manager.md (1)

333-333: Consider minimizing password String exposure.

The password is extracted to a String using String.copyValueOf(), which creates an immutable string that remains in memory until garbage collected. While this is common in many implementations, consider working with character arrays when possible to allow explicit clearing after use.

Note: This may require checking if the downstream Jasypt API supports character array inputs. If not, the current approach is acceptable for sample code.

Also applies to: 395-395

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
en/includes/references/extend/user-stores/write-a-custom-user-store-manager.md (1)

141-208: Update Java prerequisite and Carbon dependency versions for IS 7.x compatibility.

Java 1.8 is outdated; WSO2 IS 7.x requires Java 11 minimum (supported versions are Java 11 and Java 17; IS 7.1 also supports Java 21). Update the prerequisites section accordingly.

The sample pom.xml uses outdated Carbon library versions (4.10.42). For IS 7.x custom user store manager samples, use org.wso2.carbon.user.core version 4.4.11 instead, and verify all other Carbon dependencies (user.api, utils) match the product-aligned versions for the target IS 7.x release.

Also verify the maven-compiler-plugin version (currently 3.8.1) is still current for IS 7.x builds.

♻️ Duplicate comments (1)
en/includes/references/extend/user-stores/write-a-custom-user-store-manager.md (1)

332-375: Resource leak in JDBC sample (already noted previously).

The connection, statement, and result set aren’t closed, and rollback uses a fresh getDBConnection() call instead of the same connection. This was flagged in prior review comments and remains in the sample.

if (sql.contains(UserCoreConstants.UM_TENANT_COLUMN)) {
prepStmt.setInt(2, this.tenantId);
}
PreparedStatement prepStmt = dbConnection.prepareStatement(sql);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The database resources (Connection, PreparedStatement, ResultSet) are not properly closed in a finally block. Shall we use try-with-resources and improve the sample code?

Comment on lines +368 to +375
try {
this.getDBConnection().rollback();
} catch (SQLException e1) {
throw new UserStoreException("Transaction rollback connection error occurred while" +
" retrieving user authentication info. Authentication Failure.", e1);
}
log.error("Error occurred while retrieving user authentication info.", exp);
throw new UserStoreException("Authentication Failure");
Copy link
Contributor

@ashensw ashensw Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rollback logic creates a new connection instead of using the existing one. Let's improve it as well.

if (dbConnection != null) {
        try {
            dbConnection.rollback();
        } catch (SQLException e1) {
            log.error("Transaction rollback failed", e1);
        }
    }
throw new UserStoreException("Authentication Failure", exp);

Comment on lines +477 to +491
## Advanced: Non-UniqueID user store managers

The UniqueID user store managers became the default in WSO2 Identity Server from version 5.10.0 onwards. If you need to implement a custom user store manager without UniqueID support (for legacy systems or specific requirements), you can extend one of these classes:

| User store manager class | When to use |
|--------------------------|-------------|
| `org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager` | Use this when your user details are stored in a **database**. This implementation handles most JDBC-based scenarios without writing a custom user store manager. |
| `org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager` | Use this when you have a **read-only LDAP user store**. This implementation doesn't allow you to insert or update users from WSO2 Identity Server. You can only read and use them in the product. |
| `org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager` | Use this when you need WSO2 Identity Server to **manipulate LDAP user store data**. |
| `org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager` | Use this when your user store is **Active Directory**. |

!!! note

For new implementations, use the UniqueID user store managers documented in the sections above. Use non-UniqueID user store managers only for compatibility with legacy systems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to mention about legacy classes in the latest docs IMO.

3. Copy the generated `org.wso2.custom.user.store-1.0.0.jar` to the `<IS_HOME>/repository/components/dropins` directory.

4. Add the following to `<IS_HOME>/repository/conf/deployment.toml`:

```toml
[user_store_mgt]
custom_user_stores=["org.wso2.custom.user.store.CustomUserStoreManager"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use org.wso2.custom.user.store.CustomUserStoreManager is also here to be consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants