Package org.keycloak.storage.user
Interface UserQueryProvider
- 
- All Known Subinterfaces:
- UserCache,- UserCache.Streams,- UserProvider,- UserProvider.Streams,- UserQueryProvider.Streams
 - All Known Implementing Classes:
- JpaUserProvider,- LDAPStorageProvider,- MapUserProvider,- UserCacheSession,- UserStorageManager
 
 public interface UserQueryProviderThis is an optional capability interface that is intended to be implemented by anyUserStorageProviderthat supports complex user querying. You must implement this interface if you want to view and manage users from the administration console. Note that all methods in this interface should limit search only to data available within the storage that is represented by this provider. They should not lookup other storage providers for additional information.- Version:
- $Revision: 1 $
- Author:
- Bill Burke
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceUserQueryProvider.StreamsDeprecated.This interface is no longer necessary, collection-based methods were removed from the parent interface and therefore the parent interface can be used directly
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static intcountUsersInGroups(Stream<UserModel> users, Set<String> groupIds)Returns the number of users from the given list of users that are in at least one of the groups given in the groups set.default Stream<UserModel>getGroupMembersStream(RealmModel realm, GroupModel group)Obtains users that belong to a specific group.Stream<UserModel>getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults)Obtains users that belong to a specific group.default Stream<UserModel>getRoleMembersStream(RealmModel realm, RoleModel role)Obtains users that have the specified role.default Stream<UserModel>getRoleMembersStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults)Searches for users that have the specified role.default intgetUsersCount(RealmModel realm)Returns the number of users, without consider any service account.default intgetUsersCount(RealmModel realm, boolean includeServiceAccount)Returns the number of users.default intgetUsersCount(RealmModel realm, String search)Returns the number of users that would be returned by a call tosearchForUserStreamdefault intgetUsersCount(RealmModel realm, String search, Set<String> groupIds)Returns the number of users that would be returned by a call tosearchForUserStreamand are members of at least one of the groups given by thegroupIdsset.default intgetUsersCount(RealmModel realm, Map<String,String> params)Returns the number of users that match the given filter parameters.default intgetUsersCount(RealmModel realm, Map<String,String> params, Set<String> groupIds)Returns the number of users that match the given filter parameters and is in at least one of the given groups.default intgetUsersCount(RealmModel realm, Set<String> groupIds)Returns the number of users that are in at least one of the groups given.default Stream<UserModel>getUsersStream(RealmModel realm)Deprecated.UsesearchForUserStream(RealmModel, Map)with an empty params map instead.default Stream<UserModel>getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults)Deprecated.UsesearchForUserStream(RealmModel, Map, Integer, Integer)with an empty params map instead.Stream<UserModel>searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue)Searches for users that have a specific attribute with a specific value.default Stream<UserModel>searchForUserStream(RealmModel realm, String search)Searches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace.Stream<UserModel>searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults)Searches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace.default Stream<UserModel>searchForUserStream(RealmModel realm, Map<String,String> params)Searches for user by parameter.Stream<UserModel>searchForUserStream(RealmModel realm, Map<String,String> params, Integer firstResult, Integer maxResults)Searches for user by parameter.
 
- 
- 
- 
Method Detail- 
getUsersCountdefault int getUsersCount(RealmModel realm) Returns the number of users, without consider any service account.- Parameters:
- realm- the realm
- Returns:
- the number of users
 
 - 
getUsersCountdefault int getUsersCount(RealmModel realm, Set<String> groupIds) Returns the number of users that are in at least one of the groups given.- Parameters:
- realm- the realm
- groupIds- set of groups IDs, the returned user needs to belong to at least one of them
- Returns:
- the number of users that are in at least one of the groups
 
 - 
getUsersCountdefault int getUsersCount(RealmModel realm, String search) Returns the number of users that would be returned by a call tosearchForUserStream- Parameters:
- realm- the realm
- search- case insensitive list of strings separated by whitespaces.
- Returns:
- number of users that match the search
 
 - 
getUsersCountdefault int getUsersCount(RealmModel realm, String search, Set<String> groupIds) Returns the number of users that would be returned by a call tosearchForUserStreamand are members of at least one of the groups given by thegroupIdsset.- Parameters:
- realm- the realm
- search- case insensitive list of strings separated by whitespaces.
- groupIds- set of groups IDs, the returned user needs to belong to at least one of them
- Returns:
- number of users that match the search and given groups
 
 - 
getUsersCountdefault int getUsersCount(RealmModel realm, Map<String,String> params) Returns the number of users that match the given filter parameters.- Parameters:
- realm- the realm
- params- filter parameters
- Returns:
- number of users that match the given filters
 
 - 
getUsersCountdefault int getUsersCount(RealmModel realm, Map<String,String> params, Set<String> groupIds) Returns the number of users that match the given filter parameters and is in at least one of the given groups.- Parameters:
- params- filter parameters
- realm- the realm
- groupIds- set if groups to check for
- Returns:
- number of users that match the given filters and groups
 
 - 
countUsersInGroupsstatic int countUsersInGroups(Stream<UserModel> users, Set<String> groupIds) Returns the number of users from the given list of users that are in at least one of the groups given in the groups set.- Parameters:
- users- list of users to check
- groupIds- id of groups that should be checked for
- Returns:
- number of users that are in at least one of the groups
 
 - 
getUsersCountdefault int getUsersCount(RealmModel realm, boolean includeServiceAccount) Returns the number of users.- Parameters:
- realm- the realm
- includeServiceAccount- if true, the number of users will also include service accounts. Otherwise, only the number of users.
- Returns:
- the number of users
 
 - 
getUsersStream@Deprecated default Stream<UserModel> getUsersStream(RealmModel realm) Deprecated.UsesearchForUserStream(RealmModel, Map)with an empty params map instead.Searches all users in the realm.- Parameters:
- realm- a reference to the realm.
- Returns:
- a non-null Streamof users.
 
 - 
getUsersStream@Deprecated default Stream<UserModel> getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults) Deprecated.UsesearchForUserStream(RealmModel, Map, Integer, Integer)with an empty params map instead.Searches all users in the realm, starting from thefirstResultand containing at mostmaxResults.- Parameters:
- realm- a reference to the realm.
- firstResult- first result to return. Ignored if negative or- null.
- maxResults- maximum number of results to return. Ignored if negative or- null.
- Returns:
- a non-null Streamof users.
 
 - 
searchForUserStreamdefault Stream<UserModel> searchForUserStream(RealmModel realm, String search) Searches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). This method is used by the admin console search box- Parameters:
- realm- a reference to the realm.
- search- case insensitive list of string separated by whitespaces.
- Returns:
- a non-null Streamof users that match the search string.
 
 - 
searchForUserStreamStream<UserModel> searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults) Searches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). This method is used by the admin console search box- Parameters:
- realm- a reference to the realm.
- search- case insensitive list of string separated by whitespaces.
- firstResult- first result to return. Ignored if negative, zero, or- null.
- maxResults- maximum number of results to return. Ignored if negative or- null.
- Returns:
- a non-null Streamof users that match the search criteria.
 
 - 
searchForUserStreamdefault Stream<UserModel> searchForUserStream(RealmModel realm, Map<String,String> params) Searches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). Valid parameters are:- UserModel.FIRST_NAME- first name (case insensitive string)
- UserModel.LAST_NAME- last name (case insensitive string)
- UserModel.EMAIL- email (case insensitive string)
- UserModel.USERNAME- username (case insensitive string)
- UserModel.EMAIL_VERIFIED- search only for users with verified/non-verified email (true/false)
- UserModel.ENABLED- search only for enabled/disabled users (true/false)
- UserModel.IDP_ALIAS- search only for users that have a federated identity from idp with the given alias configured (case sensitive string)
- UserModel.IDP_USER_ID- search for users with federated identity with the given userId (case sensitive string)
 - Parameters:
- realm- a reference to the realm.
- params- a map containing the search parameters.
- Returns:
- a non-null Streamof users that match the search parameters.
 
 - 
searchForUserStreamStream<UserModel> searchForUserStream(RealmModel realm, Map<String,String> params, Integer firstResult, Integer maxResults) Searches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). Valid parameters are:- UserModel.FIRST_NAME- first name (case insensitive string)
- UserModel.LAST_NAME- last name (case insensitive string)
- UserModel.EMAIL- email (case insensitive string)
- UserModel.USERNAME- username (case insensitive string)
- UserModel.EMAIL_VERIFIED- search only for users with verified/non-verified email (true/false)
- UserModel.ENABLED- search only for enabled/disabled users (true/false)
- UserModel.IDP_ALIAS- search only for users that have a federated identity from idp with the given alias configured (case sensitive string)
- UserModel.IDP_USER_ID- search for users with federated identity with the given userId (case sensitive string)
 - Parameters:
- realm- a reference to the realm.
- params- a map containing the search parameters.
- firstResult- first result to return. Ignored if negative, zero, or- null.
- maxResults- maximum number of results to return. Ignored if negative or- null.
- Returns:
- a non-null Streamof users that match the search criteria.
 
 - 
getGroupMembersStreamdefault Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group) Obtains users that belong to a specific group.- Parameters:
- realm- a reference to the realm.
- group- a reference to the group.
- Returns:
- a non-null Streamof users that belong to the group.
 
 - 
getGroupMembersStreamStream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults) Obtains users that belong to a specific group.- Parameters:
- realm- a reference to the realm.
- group- a reference to the group.
- firstResult- first result to return. Ignored if negative, zero, or- null.
- maxResults- maximum number of results to return. Ignored if negative or- null.
- Returns:
- a non-null Streamof users that belong to the group.
 
 - 
getRoleMembersStreamdefault Stream<UserModel> getRoleMembersStream(RealmModel realm, RoleModel role) Obtains users that have the specified role.- Parameters:
- realm- a reference to the realm.
- role- a reference to the role.
- Returns:
- a non-null Streamof users that have the specified role.
 
 - 
getRoleMembersStreamdefault Stream<UserModel> getRoleMembersStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) Searches for users that have the specified role.- Parameters:
- realm- a reference to the realm.
- role- a reference to the role.
- firstResult- first result to return. Ignored if negative or- null.
- maxResults- maximum number of results to return. Ignored if negative or- null.
- Returns:
- a non-null Streamof users that have the specified role.
 
 - 
searchForUserByUserAttributeStreamStream<UserModel> searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue) Searches for users that have a specific attribute with a specific value.- Parameters:
- realm- a reference to the realm.
- attrName- the attribute name.
- attrValue- the attribute value.
- Returns:
- a non-null Streamof users that match the search criteria.
 
 
- 
 
-