Interface RealmProvider

    • Method Detail

      • createRealm

        RealmModel createRealm​(String name)
        Creates new realm with the given name. The internal ID will be generated automatically.
        Parameters:
        name - String name of the realm
        Returns:
        Model of the created realm.
      • createRealm

        RealmModel createRealm​(String id,
                               String name)
        Created new realm with given ID and name.
        Parameters:
        id - Internal ID of the realm or null if one is to be created by the underlying store. If the store expects the ID to have a certain format (for example UUID) and the supplied ID doesn't follow the expected format, the store may replace the id with a new one at its own discretion.
        name - String name of the realm
        Returns:
        Model of the created realm.
      • getRealm

        RealmModel getRealm​(String id)
        Exact search for a realm by its internal ID.
        Parameters:
        id - Internal ID of the realm.
        Returns:
        Model of the realm
      • getRealmByName

        RealmModel getRealmByName​(String name)
        Exact search for a realm by its name.
        Parameters:
        name - String name of the realm
        Returns:
        Model of the realm
      • getRealmsStream

        Stream<RealmModel> getRealmsStream()
        Returns realms as a stream.
        Returns:
        Stream of RealmModel. Never returns null.
      • getRealmsWithProviderTypeStream

        Stream<RealmModel> getRealmsWithProviderTypeStream​(Class<?> type)
        Returns stream of realms which has component with the given provider type.
        Parameters:
        type - Class<?> Type of the provider.
        Returns:
        Stream of RealmModel. Never returns null.
      • removeRealm

        boolean removeRealm​(String id)
        Removes realm with the given id.
        Parameters:
        id - of realm.
        Returns:
        true if the realm was successfully removed.
      • removeClientInitialAccessModel

        default void removeClientInitialAccessModel​(RealmModel realm,
                                                    String id)
      • removeExpiredClientInitialAccess

        void removeExpiredClientInitialAccess()
        Removes all expired client initial accesses from all realms.
      • deleteLocalizationTextsByLocale

        boolean deleteLocalizationTextsByLocale​(RealmModel realm,
                                                String locale)
      • addClient

        ClientModel addClient​(RealmModel realm,
                              String id,
                              String clientId)
        Deprecated.
        Use the corresponding method from ClientProvider.
        Description copied from interface: ClientProvider
        Adds a client with given internal ID and clientId to the given realm.
        Specified by:
        addClient in interface ClientProvider
        Parameters:
        realm - Realm owning this client.
        id - Internal ID of the client or null if one is to be created by the underlying store
        clientId - String that identifies the client to the external parties. Maps to client_id in OIDC or entityID in SAML.
        Returns:
        Model of the created client.
      • addClient

        default ClientModel addClient​(RealmModel realm,
                                      String clientId)
        Deprecated.
        Use the corresponding method from ClientProvider.
        Description copied from interface: ClientProvider
        Adds a client with given clientId to the given realm. The internal ID of the client will be created automatically.
        Specified by:
        addClient in interface ClientProvider
        Parameters:
        realm - Realm owning this client.
        clientId - String that identifies the client to the external parties. Maps to client_id in OIDC or entityID in SAML.
        Returns:
        Model of the created client.
      • getClients

        default List<ClientModel> getClients​(RealmModel realm,
                                             Integer firstResult,
                                             Integer maxResults)
        Deprecated.
        Use the corresponding method from ClientProvider.
        Description copied from interface: ClientProvider
        Returns the clients of the given realm.
        Specified by:
        getClients in interface ClientProvider
        Parameters:
        realm - Realm.
        firstResult - First result to return. Ignored if negative or null.
        maxResults - Maximum number of results to return. Ignored if negative or null.
        Returns:
        List of the clients. Never returns null.
      • searchClientsByClientId

        default List<ClientModel> searchClientsByClientId​(String clientId,
                                                          Integer firstResult,
                                                          Integer maxResults,
                                                          RealmModel realm)
        Deprecated.
        Use the corresponding method from ClientProvider.
        Description copied from interface: ClientLookupProvider
        Case-insensitive search for clients that contain the given string in their public client identifier.
        Specified by:
        searchClientsByClientId in interface ClientLookupProvider
        Parameters:
        clientId - Searched substring of the public client identifier (client_id in OIDC or entityID in SAML.)
        firstResult - First result to return. Ignored if negative or null.
        maxResults - Maximum number of results to return. Ignored if negative or null.
        realm - Realm to limit the search for clients.
        Returns:
        List of ClientModel or an empty list if no client is found.
      • getClientByClientId

        default ClientModel getClientByClientId​(String clientId,
                                                RealmModel realm)
        Deprecated.
        Use the corresponding method from ClientProvider.
        Description copied from interface: ClientLookupProvider
        Exact search for a client by its public client identifier.
        Specified by:
        getClientByClientId in interface ClientLookupProvider
        Parameters:
        clientId - String that identifies the client to the external parties. Maps to client_id in OIDC or entityID in SAML.
        realm - Realm to limit the search.
        Returns:
        Model of the client, or null if no client is found.
      • removeClient

        default boolean removeClient​(String id,
                                     RealmModel realm)
        Deprecated.
        Use the corresponding method from ClientProvider.
        Description copied from interface: ClientProvider
        Removes given client from the given realm.
        Specified by:
        removeClient in interface ClientProvider
        Parameters:
        id - Internal ID of the client
        realm - Realm.
        Returns:
        true if the client existed and has been removed, false otherwise.
      • getClientsCount

        long getClientsCount​(RealmModel realm)
        Deprecated.
        Use the corresponding method from ClientProvider.
        Description copied from interface: ClientProvider
        Returns number of clients in the given realm
        Specified by:
        getClientsCount in interface ClientProvider
        Parameters:
        realm - Realm.
        Returns:
        Number of the clients in the given realm.
      • addRealmRole

        default RoleModel addRealmRole​(RealmModel realm,
                                       String name)
        Deprecated.
        Use the corresponding method from RoleProvider.
        Description copied from interface: RoleProvider
        Adds a realm role with given name to the given realm. The internal ID of the role will be created automatically.
        Specified by:
        addRealmRole in interface RoleProvider
        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)
        Deprecated.
        Use the corresponding method from RoleProvider.
        Description copied from interface: RoleProvider
        Adds a realm role with given internal ID and name to the given realm.
        Specified by:
        addRealmRole in interface RoleProvider
        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.
      • getRealmRoles

        default Set<RoleModel> getRealmRoles​(RealmModel realm)
        Deprecated.
        Use the corresponding method from RoleProvider.
        Description copied from interface: RoleProvider
        Returns all the realm roles of the given realm. Effectively the same as the call getRealmRoles(realm, null, null).
        Specified by:
        getRealmRoles in interface RoleProvider
        Parameters:
        realm - Realm.
        Returns:
        List of the roles. Never returns null.
      • moveGroup

        void moveGroup​(RealmModel realm,
                       GroupModel group,
                       GroupModel toParent)
        Deprecated.
        Use the corresponding method from GroupProvider.
        Description copied from interface: GroupProvider
        This method is used for moving groups in group structure, for example:
        • making an existing child group child group of some other group,
        • setting a top level group (i.e. group without parent group) child of some group,
        • making a child group top level group (i.e. removing its parent group).
          Specified by:
          moveGroup in interface GroupProvider
          Parameters:
          realm - Realm owning this group.
          group - Group to update.
          toParent - New parent group, or null if we are moving the group to top level group.
        • getGroupById

          default GroupModel getGroupById​(String id,
                                          RealmModel realm)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Returns a group from the given realm with the corresponding id
          Specified by:
          getGroupById in interface GroupProvider
          Parameters:
          id - Id.
          realm - Realm.
          Returns:
          GroupModel with the corresponding id.
        • getGroupsCount

          Long getGroupsCount​(RealmModel realm,
                              Boolean onlyTopGroups)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Returns a number of groups/top level groups (i.e. groups without parent group) for the given realm.
          Specified by:
          getGroupsCount in interface GroupProvider
          Parameters:
          realm - Realm.
          onlyTopGroups - When true the function returns a count of top level groups only.
          Returns:
          Number of groups/top level groups.
        • getGroupsCountByNameContaining

          Long getGroupsCountByNameContaining​(RealmModel realm,
                                              String search)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Returns the number of top level groups containing groups with the given string in name for the given realm.
          Specified by:
          getGroupsCountByNameContaining in interface GroupProvider
          Parameters:
          realm - Realm.
          search - Case insensitive string which will be searched for.
          Returns:
          Number of groups with the given string in its name.
        • getGroupsByRole

          default List<GroupModel> getGroupsByRole​(RealmModel realm,
                                                   RoleModel role,
                                                   int firstResult,
                                                   int maxResults)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Returns groups with the given role in the given realm.
          Specified by:
          getGroupsByRole in interface GroupProvider
          Parameters:
          realm - Realm.
          role - Role.
          firstResult - First result to return. Ignored if negative or null.
          maxResults - Maximum number of results to return. Ignored if negative or null.
          Returns:
          List of groups with the given role.
        • getTopLevelGroups

          default List<GroupModel> getTopLevelGroups​(RealmModel realm)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Returns all top level groups (i.e. groups without parent group) for the given realm.
          Specified by:
          getTopLevelGroups in interface GroupProvider
          Parameters:
          realm - Realm.
          Returns:
          List of all top level groups in the realm.
        • getTopLevelGroups

          default List<GroupModel> getTopLevelGroups​(RealmModel realm,
                                                     Integer first,
                                                     Integer max)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Returns top level groups (i.e. groups without parent group) for the given realm.
          Specified by:
          getTopLevelGroups in interface GroupProvider
          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:
          List of top level groups in the realm.
        • searchForGroupByName

          default List<GroupModel> searchForGroupByName​(RealmModel realm,
                                                        String search,
                                                        Integer first,
                                                        Integer max)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupLookupProvider
          Returns groups with the given string in name for the given realm.
          Specified by:
          searchForGroupByName in interface GroupLookupProvider
          Parameters:
          realm - Realm.
          search - Case sensitive searched string.
          first - First result to return. Ignored if null.
          max - Maximum number of results to return. Ignored if null.
          Returns:
          List of groups with the given string in name.
        • removeGroup

          boolean removeGroup​(RealmModel realm,
                              GroupModel group)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Removes the given group for the given realm.
          Specified by:
          removeGroup in interface GroupProvider
          Parameters:
          realm - Realm.
          group - Group.
          Returns:
          true if the group was removed, false if group doesn't exist or doesn't belong to the given realm
        • createGroup

          default GroupModel createGroup​(RealmModel realm,
                                         String name)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Creates a new group with the given name in the given realm. Effectively the same as createGroup(realm, null, name, null).
          Specified by:
          createGroup in interface GroupProvider
          Parameters:
          realm - Realm.
          name - Name.
          Returns:
          Model of the created group.
        • createGroup

          default GroupModel createGroup​(RealmModel realm,
                                         String id,
                                         String name)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Creates a new group with the given id and name in the given realm. Effectively the same as createGroup(realm, id, name, null)
          Specified by:
          createGroup in interface GroupProvider
          Parameters:
          realm - Realm.
          id - Id.
          name - Name.
          Returns:
          Model of the created group
        • createGroup

          default GroupModel createGroup​(RealmModel realm,
                                         String name,
                                         GroupModel toParent)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Creates a new group with the given name and parent to the given realm. Effectively the same as createGroup(realm, null, name, toParent).
          Specified by:
          createGroup in interface GroupProvider
          Parameters:
          realm - Realm.
          name - Name.
          toParent - Parent group.
          Returns:
          Model of the created group.
        • createGroup

          GroupModel createGroup​(RealmModel realm,
                                 String id,
                                 String name,
                                 GroupModel toParent)
          Deprecated.
          Use the corresponding method from GroupProvider.
          Description copied from interface: GroupProvider
          Creates a new group with the given name, id, name and parent to the given realm.
          Specified by:
          createGroup in interface GroupProvider
          Parameters:
          realm - Realm.
          id - Id, will be generated if null.
          name - Name.
          toParent - Parent group, or null if the group is top level group
          Returns:
          Model of the created group