Record Class KeycloakAdminClient
java.lang.Object
java.lang.Record
org.bremersee.keycloak.api.webflux.KeycloakAdminClient
The keycloak admin client.
- Author:
- Christian Bremer
-
Constructor Summary
ConstructorsConstructorDescriptionKeycloakAdminClient(@NonNull AdminApi adminApi) Creates an instance of aKeycloakAdminClientrecord class. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void> addUserToGroup(@NonNull String realm, @NonNull String userId, @NonNull String groupId) Adds the given user to the given group.@NonNull AdminApiadminApi()Returns the value of theadminApirecord component.reactor.core.publisher.Mono<GroupRepresentation> createSubGroup(@NonNull String realm, @NonNull String groupId, @NonNull GroupRepresentation group) Creates a subgroup.reactor.core.publisher.Mono<Void> deleteGroup(@NonNull String realm, @NonNull String groupId) Deletes group.final booleanIndicates whether some other object is "equal to" this one.reactor.core.publisher.Mono<GroupRepresentation> getGroupById(@NonNull String realm, @NonNull String groupId) Gets group by ID.reactor.core.publisher.Mono<GroupRepresentation> getGroupByPath(@NonNull String realm, @NonNull String path) Gets group by path.reactor.core.publisher.Flux<UserRepresentation> getGroupMembers(@NonNull String realm, @NonNull String groupId, @Nullable Boolean briefRepresentation, @Nullable Integer first, @Nullable Integer max) Gets group members.reactor.core.publisher.Flux<GroupRepresentation> getGroups(@NonNull String realm, @Nullable GetGroupsParameters parameters) Get group hierarchy.reactor.core.publisher.Flux<GroupRepresentation> getSubGroups(@NonNull String realm, @NonNull String groupId, @Nullable GetGroupsParameters parameters) Gets subgroups.reactor.core.publisher.Mono<UserRepresentation> getUserById(@NonNull String realm, @NonNull String userId, @Nullable Boolean userProfileMetadata) Get representation of the user.reactor.core.publisher.Flux<UserRepresentation> getUsers(@NonNull String realm, @Nullable GetUsersParameters parameters) Returns a stream of users.final inthashCode()Returns a hash code value for this object.reactor.core.publisher.Mono<Void> removeUserFromGroup(@NonNull String realm, @NonNull String userId, @NonNull String groupId) Removes the given user from the given group.reactor.core.publisher.Mono<GroupRepresentation> saveGroup(@NonNull String realm, @NonNull GroupRepresentation group) Creates or updates a group.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
KeycloakAdminClient
Creates an instance of aKeycloakAdminClientrecord class.- Parameters:
adminApi- the value for theadminApirecord 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 nameparameters- 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 nameuserId- the user IDuserProfileMetadata- 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 nameuserId- the user IDgroupId- 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 nameuserId- the user IDgroupId- 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 nameparameters- 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 namegroupId- 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 namepath- 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 namegroupId- the group IDbriefRepresentation- 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 offsetmax- 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 namegroup- 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 namegroupId- the parent group IDgroup- 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 realmgroupId- the group idparameters- 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 namegroupId- the group ID- Returns:
- void
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
adminApi
Returns the value of theadminApirecord component.- Returns:
- the value of the
adminApirecord component
-