Package org.keycloak.storage.user
Interface UserQueryProvider.Streams
-
- All Superinterfaces:
UserQueryProvider
- All Known Subinterfaces:
UserCache.Streams,UserProvider.Streams
- Enclosing interface:
- UserQueryProvider
public static interface UserQueryProvider.Streams extends UserQueryProvider
TheUserQueryProvider.Streamsinterface makes all collection-based methods inUserQueryProviderdefault by providing implementations that delegate to theStream-based variants instead of the other way around. It allows for implementations to focus on theStream-based approach for processing sets of data and benefit from the potential memory and performance optimizations of that approach.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.storage.user.UserQueryProvider
UserQueryProvider.Streams
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default List<UserModel>getGroupMembers(RealmModel realm, GroupModel group)Get users that belong to a specific group.default List<UserModel>getGroupMembers(RealmModel realm, GroupModel group, int firstResult, int maxResults)Gets paginated list of users that belong to a specific group.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 List<UserModel>getUsers(RealmModel realm)default List<UserModel>getUsers(RealmModel realm, int firstResult, int maxResults)default intgetUsersCount(String search, RealmModel realm)default intgetUsersCount(String search, RealmModel realm, Set<String> groupIds)default intgetUsersCount(Map<String,String> params, RealmModel realm)default intgetUsersCount(Map<String,String> params, RealmModel realm, Set<String> groupIds)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 Stream<UserModel>getUsersStream(RealmModel realm)Searches all users in the realm.Stream<UserModel>getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults)Searches all users in the realm, starting from thefirstResultand containing at mostmaxResults.default List<UserModel>searchForUser(String search, RealmModel realm)Searches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace.default List<UserModel>searchForUser(String search, RealmModel realm, int firstResult, int maxResults)Searches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace.default List<UserModel>searchForUser(Map<String,String> params, RealmModel realm)Search for user by a map of parameters.default List<UserModel>searchForUser(Map<String,String> params, RealmModel realm, int firstResult, int maxResults)Search for user by parameter.default List<UserModel>searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm)Search for users that have a specific attribute with a specific value.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.-
Methods inherited from interface org.keycloak.storage.user.UserQueryProvider
getRoleMembers, getRoleMembers, getRoleMembersStream, getRoleMembersStream, getUsersCount, getUsersCount, getUsersCount
-
-
-
-
Method Detail
-
getUsersCount
default int getUsersCount(RealmModel realm, String search)
Description copied from interface:UserQueryProviderReturns the number of users that would be returned by a call tosearchForUserStream- Specified by:
getUsersCountin interfaceUserQueryProvider- Parameters:
realm- the realmsearch- case insensitive list of strings separated by whitespaces.- Returns:
- number of users that match the search
-
getUsersCount
default int getUsersCount(String search, RealmModel realm)
- Specified by:
getUsersCountin interfaceUserQueryProvider
-
getUsersCount
default int getUsersCount(RealmModel realm, String search, Set<String> groupIds)
Description copied from interface:UserQueryProviderReturns the number of users that would be returned by a call tosearchForUserStreamand are members of at least one of the groups given by thegroupIdsset.- Specified by:
getUsersCountin interfaceUserQueryProvider- Parameters:
realm- the realmsearch- 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
-
getUsersCount
default int getUsersCount(String search, RealmModel realm, Set<String> groupIds)
- Specified by:
getUsersCountin interfaceUserQueryProvider
-
getUsersCount
default int getUsersCount(RealmModel realm, Map<String,String> params)
Description copied from interface:UserQueryProviderReturns the number of users that match the given filter parameters.- Specified by:
getUsersCountin interfaceUserQueryProvider- Parameters:
realm- the realmparams- filter parameters- Returns:
- number of users that match the given filters
-
getUsersCount
default int getUsersCount(Map<String,String> params, RealmModel realm)
- Specified by:
getUsersCountin interfaceUserQueryProvider
-
getUsersCount
default int getUsersCount(RealmModel realm, Map<String,String> params, Set<String> groupIds)
Description copied from interface:UserQueryProviderReturns the number of users that match the given filter parameters and is in at least one of the given groups.- Specified by:
getUsersCountin interfaceUserQueryProvider- Parameters:
realm- the realmparams- filter parametersgroupIds- set if groups to check for- Returns:
- number of users that match the given filters and groups
-
getUsersCount
default int getUsersCount(Map<String,String> params, RealmModel realm, Set<String> groupIds)
- Specified by:
getUsersCountin interfaceUserQueryProvider
-
getUsers
default List<UserModel> getUsers(RealmModel realm)
- Specified by:
getUsersin interfaceUserQueryProvider
-
getUsersStream
default Stream<UserModel> getUsersStream(RealmModel realm)
Description copied from interface:UserQueryProviderSearches all users in the realm.- Specified by:
getUsersStreamin interfaceUserQueryProvider- Parameters:
realm- a reference to the realm.- Returns:
- a non-null
Streamof users.
-
getUsers
default List<UserModel> getUsers(RealmModel realm, int firstResult, int maxResults)
- Specified by:
getUsersin interfaceUserQueryProvider
-
getUsersStream
Stream<UserModel> getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults)
Description copied from interface:UserQueryProviderSearches all users in the realm, starting from thefirstResultand containing at mostmaxResults.- Specified by:
getUsersStreamin interfaceUserQueryProvider- Parameters:
realm- a reference to the realm.firstResult- first result to return. Ignored if negative ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users.
-
searchForUser
default List<UserModel> searchForUser(String search, RealmModel realm)
Description copied from interface:UserQueryProviderSearches 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- Specified by:
searchForUserin interfaceUserQueryProvider- Parameters:
search- case insensitive list of string separated by whitespaces.realm- realm to search within- Returns:
- list of users that satisfies the given search condition
-
searchForUserStream
default Stream<UserModel> searchForUserStream(RealmModel realm, String search)
Description copied from interface:UserQueryProviderSearches 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- Specified by:
searchForUserStreamin interfaceUserQueryProvider- 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.
-
searchForUser
default List<UserModel> searchForUser(String search, RealmModel realm, int firstResult, int maxResults)
Description copied from interface:UserQueryProviderSearches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace. The resulting user list should be paginated with respect to parametersfirstResultandmaxResultsIf 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- Specified by:
searchForUserin interfaceUserQueryProvider- Parameters:
search- case insensitive list of string separated by whitespaces.realm- a reference to the realmfirstResult- first result to return. Ignored if negative or zero.maxResults- maximum number of results to return. Ignored if negative.- Returns:
- paginated list of users from the realm that satisfies given search
-
searchForUserStream
Stream<UserModel> searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults)
Description copied from interface:UserQueryProviderSearches 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- Specified by:
searchForUserStreamin interfaceUserQueryProvider- 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, ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that match the search criteria.
-
searchForUser
default List<UserModel> searchForUser(Map<String,String> params, RealmModel realm)
Description copied from interface:UserQueryProviderSearch for user by a map of parameters. 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)
- Specified by:
searchForUserin interfaceUserQueryProvider- Parameters:
params- a map containing the search parametersrealm- a reference to the realm- Returns:
- list of users that satisfies given search conditions
-
searchForUserStream
default Stream<UserModel> searchForUserStream(RealmModel realm, Map<String,String> params)
Description copied from interface:UserQueryProviderSearches 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)
- Specified by:
searchForUserStreamin interfaceUserQueryProvider- 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.
-
searchForUser
default List<UserModel> searchForUser(Map<String,String> params, RealmModel realm, int firstResult, int maxResults)
Description copied from interface:UserQueryProviderSearch for user by parameter. 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)
- Specified by:
searchForUserin interfaceUserQueryProvider- Parameters:
params- a map containing the search parameters.realm- a reference to the realm.firstResult- first result to return. Ignored if negative.maxResults- maximum number of results to return. Ignored if negative.- Returns:
- a non-null
Streamof users that match the search criteria.
-
searchForUserStream
Stream<UserModel> searchForUserStream(RealmModel realm, Map<String,String> params, Integer firstResult, Integer maxResults)
Description copied from interface:UserQueryProviderSearches 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)
- Specified by:
searchForUserStreamin interfaceUserQueryProvider- Parameters:
realm- a reference to the realm.params- a map containing the search parameters.firstResult- first result to return. Ignored if negative, zero, ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that match the search criteria.
-
getGroupMembers
default List<UserModel> getGroupMembers(RealmModel realm, GroupModel group)
Description copied from interface:UserQueryProviderGet users that belong to a specific group.- Specified by:
getGroupMembersin interfaceUserQueryProvider- Parameters:
realm- a reference to the realmgroup- a reference to the group- Returns:
- a list of all users that are members of the given group
-
getGroupMembersStream
default Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group)
Description copied from interface:UserQueryProviderObtains users that belong to a specific group.- Specified by:
getGroupMembersStreamin interfaceUserQueryProvider- Parameters:
realm- a reference to the realm.group- a reference to the group.- Returns:
- a non-null
Streamof users that belong to the group.
-
getGroupMembers
default List<UserModel> getGroupMembers(RealmModel realm, GroupModel group, int firstResult, int maxResults)
Description copied from interface:UserQueryProviderGets paginated list of users that belong to a specific group.- Specified by:
getGroupMembersin interfaceUserQueryProvider- Parameters:
realm- a reference to the realmgroup- a reference to the groupfirstResult- first result to return. Ignored if negative or zero.maxResults- maximum number of results to return. Ignored if negative.- Returns:
- paginated list of members of the given group
-
getGroupMembersStream
Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults)
Description copied from interface:UserQueryProviderObtains users that belong to a specific group.- Specified by:
getGroupMembersStreamin interfaceUserQueryProvider- Parameters:
realm- a reference to the realm.group- a reference to the group.firstResult- first result to return. Ignored if negative, zero, ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that belong to the group.
-
searchForUserByUserAttribute
default List<UserModel> searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm)
Description copied from interface:UserQueryProviderSearch for users that have a specific attribute with a specific value.- Specified by:
searchForUserByUserAttributein interfaceUserQueryProvider- Parameters:
attrName- a name of the attribute that will be searchedattrValue- a value of the attribute that will be searchedrealm- a reference to the realm- Returns:
- list of users with the given attribute name and value
-
searchForUserByUserAttributeStream
Stream<UserModel> searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue)
Description copied from interface:UserQueryProviderSearches for users that have a specific attribute with a specific value.- Specified by:
searchForUserByUserAttributeStreamin interfaceUserQueryProvider- 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.
-
-