Package org.keycloak.storage.role
Interface RoleLookupProvider
- All Known Subinterfaces:
CacheRealmProvider,RoleProvider,RoleStorageProvider
- All Known Implementing Classes:
JpaRealmProvider,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.searchForClientRolesStream(RealmModel realm, String search, Stream<String> excludedIds, Integer first, Integer max) Case-insensitive search for client roles that contain the given string in their name or their client's public identifier (clientId - (client_idin OIDC orentityIDin SAML)).searchForClientRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) Case-insensitive search for client roles that contain the given string in its name or their client's public identifier (clientId - (client_idin OIDC orentityIDin SAML)).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
nullif 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
nullif 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.
-
searchForClientRolesStream
Stream<RoleModel> searchForClientRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) Case-insensitive search for client roles that contain the given string in its name or their client's public identifier (clientId - (client_idin OIDC orentityIDin SAML)).- Parameters:
realm- Realm.ids- Stream of ids to include in search. Ignored whennull. Returns emptyStreamwhen empty.search- String to search by role's name or client's public identifier.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 where role name or client public identifier contains given search string.
Never returns
null.
-
searchForClientRolesStream
Stream<RoleModel> searchForClientRolesStream(RealmModel realm, String search, Stream<String> excludedIds, Integer first, Integer max) Case-insensitive search for client roles that contain the given string in their name or their client's public identifier (clientId - (client_idin OIDC orentityIDin SAML)).- Parameters:
realm- Realm.search- String to search by role's name or client's public identifier.excludedIds- Stream of ids to exclude. Ignored if empty ornull.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 where role name or client's public identifier contains given search string.
Never returns
null.
-