Package org.keycloak.storage.user
Interface UserQueryMethodsProvider
- All Known Subinterfaces:
UserCache
,UserProvider
,UserQueryProvider
- All Known Implementing Classes:
JpaUserProvider
,LDAPStorageProvider
,UserCacheSession
,UserStorageManager
public interface UserQueryMethodsProvider
This is an optional capability interface that is intended to be implemented by any
UserStorageProvider
that 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
-
Method Summary
Modifier and TypeMethodDescriptiongetGroupMembersStream
(RealmModel realm, GroupModel group) Obtains users that belong to a specific group.getGroupMembersStream
(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults) Obtains users that belong to a specific group.getGroupMembersStream
(RealmModel realm, GroupModel group, String search, Boolean exact, Integer first, Integer max) Obtains users that belong to a specific group, filtered according to the search parameters.getRoleMembersStream
(RealmModel realm, RoleModel role) Obtains users that have the specified role.getRoleMembersStream
(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) Searches for users that have the specified role.searchForUserByUserAttributeStream
(RealmModel realm, String attrName, String attrValue) Searches for users that have a specific attribute with a specific value.searchForUserStream
(RealmModel realm, String search) Deprecated.searchForUserStream
(RealmModel realm, String search, Integer firstResult, Integer maxResults) Deprecated.UsesearchForUserStream(RealmModel, Map, Integer, Integer)
with anparams
map containingUserModel.SEARCH
instead.searchForUserStream
(RealmModel realm, Map<String, String> params) Searches for user by parameter.searchForUserStream
(RealmModel realm, Map<String, String> params, Integer firstResult, Integer maxResults) Searches for user by parameter.
-
Method Details
-
searchForUserStream
Deprecated.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- 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.
-
searchForUserStream
@Deprecated default Stream<UserModel> searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults) Deprecated.UsesearchForUserStream(RealmModel, Map, Integer, Integer)
with anparams
map containingUserModel.SEARCH
instead.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- 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.
-
searchForUserStream
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.SEARCH
- search for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace, whenSEARCH
is set all other params are ignoredUserModel.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.EXACT
- whether search with FIRST_NAME, LAST_NAME, USERNAME or EMAIL should be exact matchUserModel.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)
Any other parameters will be treated as custom user attributes.
This method is used by the REST API when querying users.
- 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.
-
searchForUserStream
Stream<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.SEARCH
- search for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace, whenSEARCH
is set all other params are ignoredUserModel.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.EXACT
- whether search with FIRST_NAME, LAST_NAME, USERNAME or EMAIL should be exact matchUserModel.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)
Any other parameters will be treated as custom user attributes.
This method is used by the REST API when querying users.
- 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.
-
getGroupMembersStream
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
Stream
of users that belong to the group.
-
getGroupMembersStream
Stream<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, ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of users that belong to the group.
-
getGroupMembersStream
default Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, String search, Boolean exact, Integer first, Integer max) Obtains users that belong to a specific group, filtered according to the search parameters.- Parameters:
realm
- a reference to the realm.group
- a reference to the group.search
- the search string. It can represent either the user's username, e-mail, first name, or last name.exact
- a boolean indicating if the search should be exact or not. Iftrue
, it selects only users whose main attributes (username, e-mail, first name, or last name) exactly match the search string. Iffalse
, it selects the users whose main attributes partially match the search string.first
- the position of the first result to be processed (pagination offset). Ignored if negative ornull
.max
- the maximum number of results to be returned. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of filtered users that belong to the group.
-
getRoleMembersStream
Obtains users that have the specified role.- Parameters:
realm
- a reference to the realm.role
- a reference to the role.- Returns:
- a non-null
Stream
of users that have the specified role.
-
getRoleMembersStream
default 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 ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of users that have the specified role.
-
searchForUserByUserAttributeStream
Stream<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
Stream
of users that match the search criteria.
-
searchForUserStream(RealmModel, Map)
with anparams
map containingUserModel.SEARCH
instead.