diff --git a/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs b/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs
index 360be6c8..d8080a37 100644
--- a/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs
+++ b/src/Keycloak.AuthServices.Sdk/Admin/Constants/KeycloakClientApiConstants.cs
@@ -40,5 +40,11 @@ internal static class KeycloakClientApiConstants
internal const string ExecuteActionsEmail = $"{GetRealm}/users/{{id}}/execute-actions-email";
+
+
+ internal const string GetGroups = $"{GetRealm}/groups";
+
+ internal const string GetGroup = $"{GetRealm}/groups/{{id}}";
+
#endregion
}
diff --git a/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakClient.cs b/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakClient.cs
index c0b9ee90..cfeeb70e 100644
--- a/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakClient.cs
+++ b/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakClient.cs
@@ -7,6 +7,6 @@ namespace Keycloak.AuthServices.Sdk.Admin;
/// Aggregates multiple clients. and
///
public interface IKeycloakClient
- : IKeycloakRealmClient, IKeycloakProtectedResourceClient, IKeycloakUserClient
+ : IKeycloakRealmClient, IKeycloakProtectedResourceClient, IKeycloakUserClient, IKeycloakGroupClient
{
}
diff --git a/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs b/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs
new file mode 100644
index 00000000..6ba9eede
--- /dev/null
+++ b/src/Keycloak.AuthServices.Sdk/Admin/IKeycloakGroupClient.cs
@@ -0,0 +1,34 @@
+namespace Keycloak.AuthServices.Sdk.Admin;
+
+using System.Collections;
+using System.Threading.Tasks;
+using Constants;
+using Models;
+using Refit;
+using Requests.Users;
+
+///
+/// Group management
+///
+[Headers("Accept: application/json")]
+public interface IKeycloakGroupClient
+{
+
+ ///
+ /// Get a stream of groups on the realm.
+ ///
+ /// Realm name (not ID).
+ /// Optional query parameters.
+ /// A stream of groups, filtered according to query parameters.
+ [Get(KeycloakClientApiConstants.GetGroups)]
+ Task> GetGroups(string realm, [Query] GetUsersRequestParameters? parameters = default);
+
+ ///
+ /// Get representation of a group.
+ ///
+ /// Realm name (not ID).
+ /// group ID.
+ /// The group representation.
+ [Get(KeycloakClientApiConstants.GetGroups)]
+ Task GetGroups(string realm, [AliasAs("id")] string groupId);
+}
diff --git a/src/Keycloak.AuthServices.Sdk/Admin/Models/Group/Group.cs b/src/Keycloak.AuthServices.Sdk/Admin/Models/Group/Group.cs
new file mode 100644
index 00000000..6655765a
--- /dev/null
+++ b/src/Keycloak.AuthServices.Sdk/Admin/Models/Group/Group.cs
@@ -0,0 +1,18 @@
+#pragma warning disable CS1591, CS8618
+namespace Keycloak.AuthServices.Sdk.Admin.Models;
+
+using System.Collections.Generic;
+
+///
+/// Group representation.
+///
+public class Group
+{
+ public string? Id { get; init; }
+ public string? Name { get; init; }
+ public string? Path { get; init; }
+ public Dictionary? ClientRoles { get; init; }
+ public string[]? RealmRoles { get; init; }
+ public Group[]? SubGroups { get; init; }
+ public Dictionary? Attributes { get; init; }
+}
diff --git a/src/Keycloak.AuthServices.Sdk/Keycloak.AuthServices.Sdk.csproj b/src/Keycloak.AuthServices.Sdk/Keycloak.AuthServices.Sdk.csproj
index 61f0c5e5..76fe3e28 100644
--- a/src/Keycloak.AuthServices.Sdk/Keycloak.AuthServices.Sdk.csproj
+++ b/src/Keycloak.AuthServices.Sdk/Keycloak.AuthServices.Sdk.csproj
@@ -32,4 +32,8 @@
+
+
+
+