Package org.keycloak.storage.user
Interface UserQueryProvider.Streams
-
- All Superinterfaces:
UserQueryProvider
- All Known Subinterfaces:
UserCache.Streams
,UserProvider.Streams
- All Known Implementing Classes:
JpaUserProvider
,LDAPStorageProvider
,MapUserProvider
,UserCacheSession
,UserStorageManager
- Enclosing interface:
- UserQueryProvider
public static interface UserQueryProvider.Streams extends UserQueryProvider
TheUserQueryProvider.Streams
interface makes all collection-based methods inUserQueryProvider
default 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 int
getUsersCount(String search, RealmModel realm)
default int
getUsersCount(String search, RealmModel realm, Set<String> groupIds)
default int
getUsersCount(Map<String,String> params, RealmModel realm)
default int
getUsersCount(Map<String,String> params, RealmModel realm, Set<String> groupIds)
default int
getUsersCount(RealmModel realm, String search)
Returns the number of users that would be returned by a call tosearchForUserStream
default int
getUsersCount(RealmModel realm, String search, Set<String> groupIds)
Returns the number of users that would be returned by a call tosearchForUserStream
and are members of at least one of the groups given by thegroupIds
set.default int
getUsersCount(RealmModel realm, Map<String,String> params)
Returns the number of users that match the given filter parameters.default 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.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 thefirstResult
and 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 insearch
separated 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 insearch
separated 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 insearch
separated 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 insearch
separated 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:UserQueryProvider
Returns the number of users that would be returned by a call tosearchForUserStream
- Specified by:
getUsersCount
in 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:
getUsersCount
in interfaceUserQueryProvider
-
getUsersCount
default int getUsersCount(RealmModel realm, String search, Set<String> groupIds)
Description copied from interface:UserQueryProvider
Returns the number of users that would be returned by a call tosearchForUserStream
and are members of at least one of the groups given by thegroupIds
set.- Specified by:
getUsersCount
in 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:
getUsersCount
in interfaceUserQueryProvider
-
getUsersCount
default int getUsersCount(RealmModel realm, Map<String,String> params)
Description copied from interface:UserQueryProvider
Returns the number of users that match the given filter parameters.- Specified by:
getUsersCount
in 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:
getUsersCount
in interfaceUserQueryProvider
-
getUsersCount
default int getUsersCount(RealmModel realm, Map<String,String> params, Set<String> groupIds)
Description copied from interface:UserQueryProvider
Returns the number of users that match the given filter parameters and is in at least one of the given groups.- Specified by:
getUsersCount
in 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:
getUsersCount
in interfaceUserQueryProvider
-
getUsers
default List<UserModel> getUsers(RealmModel realm)
- Specified by:
getUsers
in interfaceUserQueryProvider
-
getUsersStream
default Stream<UserModel> getUsersStream(RealmModel realm)
Description copied from interface:UserQueryProvider
Searches all users in the realm.- Specified by:
getUsersStream
in interfaceUserQueryProvider
- Parameters:
realm
- a reference to the realm.- Returns:
- a non-null
Stream
of users.
-
getUsers
default List<UserModel> getUsers(RealmModel realm, int firstResult, int maxResults)
- Specified by:
getUsers
in interfaceUserQueryProvider
-
getUsersStream
Stream<UserModel> getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults)
Description copied from interface:UserQueryProvider
Searches all users in the realm, starting from thefirstResult
and containing at mostmaxResults
.- Specified by:
getUsersStream
in 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
Stream
of users.
-
searchForUser
default List<UserModel> searchForUser(String search, RealmModel realm)
Description copied from interface:UserQueryProvider
Searches for users whose username, email, first name or last name contain any of the strings insearch
separated 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:
searchForUser
in 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:UserQueryProvider
Searches for users whose username, email, first name or last name contain any of the strings insearch
separated 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:
searchForUserStream
in interfaceUserQueryProvider
- Parameters:
realm
- a reference to the realm.search
- case insensitive list of string separated by whitespaces.- Returns:
- a non-null
Stream
of users that match the search string.
-
searchForUser
default List<UserModel> searchForUser(String search, RealmModel realm, int firstResult, int maxResults)
Description copied from interface:UserQueryProvider
Searches for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace. The resulting user list should be paginated with respect to parametersfirstResult
andmaxResults
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:
searchForUser
in 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:UserQueryProvider
Searches for users whose username, email, first name or last name contain any of the strings insearch
separated 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:
searchForUserStream
in 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
Stream
of users that match the search criteria.
-
searchForUser
default List<UserModel> searchForUser(Map<String,String> params, RealmModel realm)
Description copied from interface:UserQueryProvider
Search 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:
searchForUser
in 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:UserQueryProvider
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)
- Specified by:
searchForUserStream
in interfaceUserQueryProvider
- Parameters:
realm
- a reference to the realm.params
- a map containing the search parameters.- Returns:
- a non-null
Stream
of 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:UserQueryProvider
Search 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:
searchForUser
in 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
Stream
of users that match the search criteria.
-
searchForUserStream
Stream<UserModel> searchForUserStream(RealmModel realm, Map<String,String> params, Integer firstResult, Integer maxResults)
Description copied from interface:UserQueryProvider
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)
- Specified by:
searchForUserStream
in 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
Stream
of users that match the search criteria.
-
getGroupMembers
default List<UserModel> getGroupMembers(RealmModel realm, GroupModel group)
Description copied from interface:UserQueryProvider
Get users that belong to a specific group.- Specified by:
getGroupMembers
in 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:UserQueryProvider
Obtains users that belong to a specific group.- Specified by:
getGroupMembersStream
in interfaceUserQueryProvider
- Parameters:
realm
- a reference to the realm.group
- a reference to the group.- Returns:
- a non-null
Stream
of users that belong to the group.
-
getGroupMembers
default List<UserModel> getGroupMembers(RealmModel realm, GroupModel group, int firstResult, int maxResults)
Description copied from interface:UserQueryProvider
Gets paginated list of users that belong to a specific group.- Specified by:
getGroupMembers
in 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:UserQueryProvider
Obtains users that belong to a specific group.- Specified by:
getGroupMembersStream
in 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
Stream
of users that belong to the group.
-
searchForUserByUserAttribute
default List<UserModel> searchForUserByUserAttribute(String attrName, String attrValue, RealmModel realm)
Description copied from interface:UserQueryProvider
Search for users that have a specific attribute with a specific value.- Specified by:
searchForUserByUserAttribute
in 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:UserQueryProvider
Searches for users that have a specific attribute with a specific value.- Specified by:
searchForUserByUserAttributeStream
in interfaceUserQueryProvider
- Parameters:
realm
- a reference to the realm.attrName
- the attribute name.attrValue
- the attribute value.- Returns:
- a non-null
Stream
of users that match the search criteria.
-
-