Interface RoleProvider

All Superinterfaces:
Provider, RoleLookupProvider
All Known Subinterfaces:
CacheRealmProvider
All Known Implementing Classes:
JpaRealmProvider, RealmCacheSession, RoleStorageManager

public interface RoleProvider extends Provider, RoleLookupProvider
Provider of the role records.
Author:
vramik
  • Method Details

    • addRealmRole

      default RoleModel addRealmRole(RealmModel realm, String name)
      Adds a realm role with given name to the given realm. The internal ID of the role will be created automatically.
      Parameters:
      realm - Realm owning this role.
      name - String name of the role.
      Returns:
      Model of the created role.
    • addRealmRole

      RoleModel addRealmRole(RealmModel realm, String id, String name)
      Adds a realm role with given internal ID and name to the given realm.
      Parameters:
      realm - Realm owning this role.
      id - Internal ID of the role or null if one is to be created by the underlying store
      name - String name of the role.
      Returns:
      Model of the created client.
      Throws:
      IllegalArgumentException - If id does not conform the format understood by the underlying store.
    • getRealmRolesStream

      default Stream<RoleModel> getRealmRolesStream(RealmModel realm)
      Returns all the realm roles of the given realm as a stream. Effectively the same as the call getRealmRolesStream(realm, null, null).
      Parameters:
      realm - Realm.
      Returns:
      Stream of the roles. Never returns null.
    • getRealmRolesStream

      Stream<RoleModel> getRealmRolesStream(RealmModel realm, Integer first, Integer max)
      Returns the realm roles of the given realm as a stream.
      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.
    • getRolesStream

      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.
      Parameters:
      realm - Realm. Cannot be null.
      ids - Stream of ids. Returns empty Stream when 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.
    • removeRole

      boolean removeRole(RoleModel role)
      Removes given realm role from the given realm.
      Parameters:
      role - Role to be removed.
      Returns:
      true if the role existed and has been removed, false otherwise.
    • removeRoles

      void removeRoles(RealmModel realm)
      Removes all roles from the given realm.
      Parameters:
      realm - Realm.
    • addClientRole

      default RoleModel addClientRole(ClientModel client, String name)
      Adds a client role with given name to the given client. The internal ID of the role will be created automatically.
      Parameters:
      client - Client owning this role.
      name - String name of the role.
      Returns:
      Model of the created role.
    • addClientRole

      RoleModel addClientRole(ClientModel client, String id, String name)
      Adds a client role with given internal ID and name to the given client.
      Parameters:
      client - Client owning this role.
      id - Internal ID of the client role or null if one is to be created by the underlying store.
      name - String name of the role.
      Returns:
      Model of the created role.
    • getClientRolesStream

      default Stream<RoleModel> getClientRolesStream(ClientModel client)
      Returns all the client roles of the given client. Effectively the same as the call getClientRoles(client, null, null).
      Parameters:
      client - Client.
      Returns:
      Stream of the roles. Never returns null.
    • getClientRolesStream

      Stream<RoleModel> getClientRolesStream(ClientModel client, Integer first, Integer max)
      Returns the client roles of the given client.
      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.
    • removeRoles

      void removeRoles(ClientModel client)
      Removes all roles from the given client.
      Parameters:
      client - Client.