Package org.keycloak.storage.role
Interface RoleLookupProvider
- All Known Subinterfaces:
CacheRealmProvider
,RoleProvider
,RoleStorageProvider
- All Known Implementing Classes:
JpaRealmProvider
,MapRoleProvider
,RealmCacheSession
,RoleStorageManager
public interface RoleLookupProvider
Abstraction interface for lookup of both realm roles and client roles by id, name and description.
-
Method Summary
Modifier and TypeMethodDescriptiongetClientRole
(ClientModel client, String name) Exact search for a client role by given name.getRealmRole
(RealmModel realm, String name) Exact search for a role by given name.getRoleById
(RealmModel realm, String id) Exact search for a role by its internal ID..searchForClientRolesStream
(ClientModel client, String search, Integer first, Integer max) Case-insensitive search for client roles that contain the given string in their name or description.searchForRolesStream
(RealmModel realm, String search, Integer first, Integer max) Case-insensitive search for roles that contain the given string in their name or description.
-
Method Details
-
getRealmRole
Exact search for a role by given name.- Parameters:
realm
- Realm.name
- String name of the role.- Returns:
- Model of the role, or
null
if no role is found.
-
getRoleById
Exact search for a role by its internal ID..- Parameters:
realm
- Realm.id
- Internal ID of the role.- Returns:
- Model of the role.
-
searchForRolesStream
Case-insensitive search for roles that contain the given string in their name or description.- Parameters:
realm
- Realm.search
- Searched substring of the role's name or description.first
- First result to return. Ignored if negative ornull
.max
- Maximum number of results to return. Ignored if negative ornull
.- Returns:
- Stream of the realm roles their name or description contains given search string.
Never returns
null
.
-
getClientRole
Exact search for a client role by given name.- Parameters:
client
- Client.name
- String name of the role.- Returns:
- Model of the role, or
null
if no role is found.
-
searchForClientRolesStream
Stream<RoleModel> searchForClientRolesStream(ClientModel client, String search, Integer first, Integer max) Case-insensitive search for client roles that contain the given string in their name or description.- Parameters:
client
- Client.search
- String to search by role's name or description.first
- First result to return. Ignored if negative ornull
.max
- Maximum number of results to return. Ignored if negative ornull
.- Returns:
- Stream of the client roles their name or description contains given search string.
Never returns
null
.
-