This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, go to https://wso2.com/documentation/.

Counting Users and Roles with APIs

The UserStoreCountService can be used to do the following:
  • count the number of users based on user names patterns and claims
  • count the number of roles matching a role name pattern in the user store 

By default, only JDBC user store implementations support this service but the functionality can be extended to LDAP user stores or any other type of user store as well.

This service uses a property in the CountRetrieverClass user store manager configuration, where you can configure the class name that carries the count implementation for a particular user store domain.

Using the service

The functionality, exposed through the UserStoreCountService, includes the following operations. 
  • Count users matching a filter for user name
  • Count roles matching a filter for role name
  • Count users matching a filter for a claim value
  • Count users matching filters for a set of claim values (e.g., count of users whose email address ends with 'wso2.com' and mobile number starts with '033')