Package org.keycloak.models.map.role
Class MapRoleProvider
- java.lang.Object
- 
- org.keycloak.models.map.role.MapRoleProvider
 
- 
- All Implemented Interfaces:
- RoleProvider,- Provider,- RoleLookupProvider
 
 public class MapRoleProvider extends Object implements RoleProvider 
- 
- 
Constructor SummaryConstructors Constructor Description MapRoleProvider(KeycloakSession session, MapStorage<MapRoleEntity,RoleModel> roleStore)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description RoleModeladdClientRole(ClientModel client, String id, String name)Adds a client role with given internal ID andnameto the given client.RoleModeladdRealmRole(RealmModel realm, String id, String name)Adds a realm role with given internal ID andnameto the given realm.voidclose()RoleModelgetClientRole(ClientModel client, String name)Exact search for a client role by given name.Stream<RoleModel>getClientRolesStream(ClientModel client)Returns all the client roles of the given client.Stream<RoleModel>getClientRolesStream(ClientModel client, Integer first, Integer max)Returns the client roles of the given client.RoleModelgetRealmRole(RealmModel realm, String name)Exact search for a role by given name.Stream<RoleModel>getRealmRolesStream(RealmModel realm)Returns all the realm roles of the given realm as a stream.Stream<RoleModel>getRealmRolesStream(RealmModel realm, Integer first, Integer max)Returns the realm roles of the given realm as a stream.RoleModelgetRoleById(RealmModel realm, String id)Exact search for a role by its internal ID..Stream<RoleModel>getRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max)Returns a paginated stream of roles with given ids and given search value in role names.voidpreRemove(RealmModel realm)voidpreRemove(RealmModel realm, RoleModel role)booleanremoveRole(RoleModel role)Removes given realm role from the given realm.voidremoveRoles(ClientModel client)Removes all roles from the given client.voidremoveRoles(RealmModel realm)Removes all roles from the given realm.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.Stream<RoleModel>searchForRolesStream(RealmModel realm, String search, Integer first, Integer max)Case-insensitive search for roles that contain the given string in their name or description.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.keycloak.models.RoleProvideraddClientRole, addRealmRole
 
- 
 
- 
- 
- 
Constructor Detail- 
MapRoleProviderpublic MapRoleProvider(KeycloakSession session, MapStorage<MapRoleEntity,RoleModel> roleStore) 
 
- 
 - 
Method Detail- 
addRealmRolepublic RoleModel addRealmRole(RealmModel realm, String id, String name) Description copied from interface:RoleProviderAdds a realm role with given internal ID andnameto the given realm.- Specified by:
- addRealmRolein interface- RoleProvider
- Parameters:
- realm- Realm owning this role.
- id- Internal ID of the role or- nullif one is to be created by the underlying store
- name- String name of the role.
- Returns:
- Model of the created client.
 
 - 
getRealmRolesStreampublic Stream<RoleModel> getRealmRolesStream(RealmModel realm, Integer first, Integer max) Description copied from interface:RoleProviderReturns the realm roles of the given realm as a stream.- Specified by:
- getRealmRolesStreamin interface- RoleProvider
- Parameters:
- realm- Realm.
- first- First result to return. Ignored if negative or- null.
- max- Maximum number of results to return. Ignored if negative or- null.
- Returns:
- Stream of the roles. Never returns null.
 
 - 
getRolesStreampublic Stream<RoleModel> getRolesStream(RealmModel realm, Stream<String> ids, String search, Integer first, Integer max) Description copied from interface:RoleProviderReturns a paginated stream of roles with given ids and given search value in role names.- Specified by:
- getRolesStreamin interface- RoleProvider
- Parameters:
- realm- Realm. Cannot be- null.
- ids- Stream of ids. Returns empty- Streamwhen- null.
- search- Case-insensitive string to search by role's name or description. Ignored if- null.
- first- Index of the first result to return. Ignored if negative or- null.
- max- Maximum number of results to return. Ignored if negative or- null.
- Returns:
- Stream of desired roles. Never returns null.
 
 - 
getRealmRolesStreampublic Stream<RoleModel> getRealmRolesStream(RealmModel realm) Description copied from interface:RoleProviderReturns all the realm roles of the given realm as a stream. Effectively the same as the callgetRealmRolesStream(realm, null, null).- Specified by:
- getRealmRolesStreamin interface- RoleProvider
- Parameters:
- realm- Realm.
- Returns:
- Stream of the roles. Never returns null.
 
 - 
addClientRolepublic RoleModel addClientRole(ClientModel client, String id, String name) Description copied from interface:RoleProviderAdds a client role with given internal ID andnameto the given client.- Specified by:
- addClientRolein interface- RoleProvider
- Parameters:
- client- Client owning this role.
- id- Internal ID of the client role or- nullif one is to be created by the underlying store.
- name- String name of the role.
- Returns:
- Model of the created role.
 
 - 
getClientRolesStreampublic Stream<RoleModel> getClientRolesStream(ClientModel client, Integer first, Integer max) Description copied from interface:RoleProviderReturns the client roles of the given client.- Specified by:
- getClientRolesStreamin interface- RoleProvider
- Parameters:
- client- Client.
- first- First result to return. Ignored if negative or- null.
- max- Maximum number of results to return. Ignored if negative or- null.
- Returns:
- Stream of the roles. Never returns null.
 
 - 
getClientRolesStreampublic Stream<RoleModel> getClientRolesStream(ClientModel client) Description copied from interface:RoleProviderReturns all the client roles of the given client. Effectively the same as the callgetClientRoles(client, null, null).- Specified by:
- getClientRolesStreamin interface- RoleProvider
- Parameters:
- client- Client.
- Returns:
- Stream of the roles. Never returns null.
 
 - 
removeRolepublic boolean removeRole(RoleModel role) Description copied from interface:RoleProviderRemoves given realm role from the given realm.- Specified by:
- removeRolein interface- RoleProvider
- Parameters:
- role- Role to be removed.
- Returns:
- trueif the role existed and has been removed,- falseotherwise.
 
 - 
removeRolespublic void removeRoles(RealmModel realm) Description copied from interface:RoleProviderRemoves all roles from the given realm.- Specified by:
- removeRolesin interface- RoleProvider
- Parameters:
- realm- Realm.
 
 - 
removeRolespublic void removeRoles(ClientModel client) Description copied from interface:RoleProviderRemoves all roles from the given client.- Specified by:
- removeRolesin interface- RoleProvider
- Parameters:
- client- Client.
 
 - 
getRealmRolepublic RoleModel getRealmRole(RealmModel realm, String name) Description copied from interface:RoleLookupProviderExact search for a role by given name.- Specified by:
- getRealmRolein interface- RoleLookupProvider
- Parameters:
- realm- Realm.
- name- String name of the role.
- Returns:
- Model of the role, or nullif no role is found.
 
 - 
getClientRolepublic RoleModel getClientRole(ClientModel client, String name) Description copied from interface:RoleLookupProviderExact search for a client role by given name.- Specified by:
- getClientRolein interface- RoleLookupProvider
- Parameters:
- client- Client.
- name- String name of the role.
- Returns:
- Model of the role, or nullif no role is found.
 
 - 
getRoleByIdpublic RoleModel getRoleById(RealmModel realm, String id) Description copied from interface:RoleLookupProviderExact search for a role by its internal ID..- Specified by:
- getRoleByIdin interface- RoleLookupProvider
- Parameters:
- realm- Realm.
- id- Internal ID of the role.
- Returns:
- Model of the role.
 
 - 
searchForRolesStreampublic Stream<RoleModel> searchForRolesStream(RealmModel realm, String search, Integer first, Integer max) Description copied from interface:RoleLookupProviderCase-insensitive search for roles that contain the given string in their name or description.- Specified by:
- searchForRolesStreamin interface- RoleLookupProvider
- Parameters:
- realm- Realm.
- search- Searched substring of the role's name or description.
- first- First result to return. Ignored if negative or- null.
- max- Maximum number of results to return. Ignored if negative or- null.
- Returns:
- Stream of the realm roles their name or description contains given search string. 
 Never returns null.
 
 - 
searchForClientRolesStreampublic Stream<RoleModel> searchForClientRolesStream(ClientModel client, String search, Integer first, Integer max) Description copied from interface:RoleLookupProviderCase-insensitive search for client roles that contain the given string in their name or description.- Specified by:
- searchForClientRolesStreamin interface- RoleLookupProvider
- Parameters:
- client- Client.
- search- String to search by role's name or description.
- first- First result to return. Ignored if negative or- null.
- max- Maximum number of results to return. Ignored if negative or- null.
- Returns:
- Stream of the client roles their name or description contains given search string. 
 Never returns null.
 
 - 
preRemovepublic void preRemove(RealmModel realm) 
 - 
preRemovepublic void preRemove(RealmModel realm, RoleModel role) 
 
- 
 
-