Record Class KeycloakAdminClient

java.lang.Object
java.lang.Record
org.bremersee.keycloak.api.webflux.KeycloakAdminClient

public record KeycloakAdminClient(@NonNull AdminApi adminApi) extends Record
The keycloak admin client.
Author:
Christian Bremer
  • Constructor Details

    • KeycloakAdminClient

      public KeycloakAdminClient(@NonNull AdminApi adminApi)
      Creates an instance of a KeycloakAdminClient record class.
      Parameters:
      adminApi - the value for the adminApi record component
  • Method Details

    • getUsers

      public reactor.core.publisher.Flux<UserRepresentation> getUsers(@NonNull String realm, @Nullable GetUsersParameters parameters)
      Returns a stream of users. Note that the 'credentials' field in the returned UserRepresentation objects is typically not populated for performance reasons. If specific credential metadata is required, use the dedicated 'GET /admin/realms/{realm}/users/{user-id}/credentials' endpoint.
      Parameters:
      realm - the realm name
      parameters - the parameters
      Returns:
      the stream of users
    • getUserById

      public reactor.core.publisher.Mono<UserRepresentation> getUserById(@NonNull String realm, @NonNull String userId, @Nullable Boolean userProfileMetadata)
      Get representation of the user.
      Parameters:
      realm - the realm name
      userId - the user ID
      userProfileMetadata - Indicates if the user profile metadata should be added to the response
      Returns:
      the user
    • addUserToGroup

      public reactor.core.publisher.Mono<Void> addUserToGroup(@NonNull String realm, @NonNull String userId, @NonNull String groupId)
      Adds the given user to the given group.
      Parameters:
      realm - the realm name
      userId - the user ID
      groupId - the group ID
      Returns:
      void
    • removeUserFromGroup

      public reactor.core.publisher.Mono<Void> removeUserFromGroup(@NonNull String realm, @NonNull String userId, @NonNull String groupId)
      Removes the given user from the given group.
      Parameters:
      realm - the realm name
      userId - the user ID
      groupId - the group ID
      Returns:
      void
    • getGroups

      public reactor.core.publisher.Flux<GroupRepresentation> getGroups(@NonNull String realm, @Nullable GetGroupsParameters parameters)
      Get group hierarchy. Only `name` and `id` are returned. `subGroups` are only returned when using the `search` or `q` parameter. If none of these parameters is provided, the top-level groups are returned without `subGroups` being filled.
      Parameters:
      realm - the realm name
      parameters - the parameters
      Returns:
      the stream of groups
    • getGroupById

      public reactor.core.publisher.Mono<GroupRepresentation> getGroupById(@NonNull String realm, @NonNull String groupId)
      Gets group by ID.
      Parameters:
      realm - the realm name
      groupId - the group ID
      Returns:
      the group
    • getGroupByPath

      public reactor.core.publisher.Mono<GroupRepresentation> getGroupByPath(@NonNull String realm, @NonNull String path)
      Gets group by path.
      Parameters:
      realm - the realm name
      path - the group path (e.g. '/groupname-1/groupsname-2')
      Returns:
      the group
    • getGroupMembers

      public reactor.core.publisher.Flux<UserRepresentation> getGroupMembers(@NonNull String realm, @NonNull String groupId, @Nullable Boolean briefRepresentation, @Nullable Integer first, @Nullable Integer max)
      Gets group members.
      Parameters:
      realm - the realm name
      groupId - the group ID
      briefRepresentation - Only return basic information (only guaranteed to return id, username, created, first and last name, email, enabled state, email verification state, federation link, and access. Note that it means that namely user attributes, required actions, and not before are not returned.)
      first - Pagination offset
      max - Maximum results size (defaults to 100)
      Returns:
      the group members
    • saveGroup

      public reactor.core.publisher.Mono<GroupRepresentation> saveGroup(@NonNull String realm, @NonNull GroupRepresentation group)
      Creates or updates a group.
      Parameters:
      realm - the realm name
      group - the group
      Returns:
      the group
    • createSubGroup

      public reactor.core.publisher.Mono<GroupRepresentation> createSubGroup(@NonNull String realm, @NonNull String groupId, @NonNull GroupRepresentation group)
      Creates a subgroup.
      Parameters:
      realm - the realm name
      groupId - the parent group ID
      group - the subgroup
      Returns:
      the subgroup
    • getSubGroups

      public reactor.core.publisher.Flux<GroupRepresentation> getSubGroups(@NonNull String realm, @NonNull String groupId, @Nullable GetGroupsParameters parameters)
      Gets subgroups.
      Parameters:
      realm - the realm
      groupId - the group id
      parameters - the parameters
      Returns:
      the subgroups
    • deleteGroup

      public reactor.core.publisher.Mono<Void> deleteGroup(@NonNull String realm, @NonNull String groupId)
      Deletes group.
      Parameters:
      realm - the realm name
      groupId - the group ID
      Returns:
      void
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • adminApi

      public @NonNull AdminApi adminApi()
      Returns the value of the adminApi record component.
      Returns:
      the value of the adminApi record component