Keycloak.AdminSdk 0.1.0-preview.1

This is a prerelease version of Keycloak.AdminSdk.
dotnet add package Keycloak.AdminSdk --version 0.1.0-preview.1
                    
NuGet\Install-Package Keycloak.AdminSdk -Version 0.1.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Keycloak.AdminSdk" Version="0.1.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Keycloak.AdminSdk" Version="0.1.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Keycloak.AdminSdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Keycloak.AdminSdk --version 0.1.0-preview.1
                    
#r "nuget: Keycloak.AdminSdk, 0.1.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Keycloak.AdminSdk@0.1.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Keycloak.AdminSdk&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Keycloak.AdminSdk&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Tool

Keycloak.AdminSdk

CI NuGet

SDK .NET 10 fortemente tipado para integração e administração do Keycloak pela Admin REST API.

0.1.0-preview.1: preview para validação pública. Consulte a matriz de compatibilidade antes de utilizar em produção.

Principais recursos

  • Realms, Users, Clients, Client Scopes, Roles, Groups, Protocol Mappers, Identity Providers, Sessions e Events.
  • API baseada em interfaces e integrada à DI nativa do .NET.
  • Contextos imutáveis para múltiplos Realms.
  • Client Credentials recomendado e Password Grant opcional.
  • Cache e renovação concorrente de tokens.
  • IHttpClientFactory, retry seguro, jitter, circuit breaker e timeouts.
  • Provisionamento fluído com compensação de falhas.
  • OpenTelemetry opcional: logs estruturados, traces e métricas.

Instalação

dotnet add package Keycloak.AdminSdk --version 0.1.0-preview.1

Configuração mínima

builder.Services.AddKeycloakAdmin(options =>
{
    options.ServerUrl = new Uri("https://identity.example.com");
    options.DefaultRealm = "customers";
    options.AuthenticationRealm = "master";
    options.Authentication.ClientCredentials.ClientId = "admin-service";
    options.Authentication.ClientCredentials.ClientSecret = secret;
});

Uso

var tenant = keycloak.ForRealm("tenant-a");

var user = await tenant.Users.CreateAsync(
    new CreateUserRequest("alice") { Email = "alice@example.com" });

var group = await tenant.Groups.CreateAsync(new CreateGroupRequest("operators"));
await tenant.Groups.AddUserAsync(group.Id, user.Id);

Documentação

Extensão opcional de diagnóstico

Depois que o SDK principal estiver integrado e confiável, o pacote separado Keycloak.AdminSdk.Diagnostics.Mcp pode expor diagnósticos sanitizados e read-only para agentes autorizados. Ele é desabilitado por padrão e não participa do transporte de telemetria.

Arquitetura de observabilidade

OTLP é o transporte de logs, traces e métricas para Grafana ou outro backend. MCP é uma interface opcional para uma IA consultar diagnósticos sanitizados; não é utilizado como exporter.

Aplicação → OpenTelemetry/OTLP → Collector → Grafana
         └→ Diagnostic Sink → MCP read-only → IA

Nenhum exporter, servidor MCP ou provedor de IA é ativado automaticamente pelo pacote principal. Consulte o threat model antes de habilitar MCP.

Testes locais

docker-compose up -d
dotnet test Keycloak.AdminSdk.sln --configuration Release
dotnet test tests/Keycloak.AdminSdk.IntegrationTests `
  --settings tests/Keycloak.AdminSdk.IntegrationTests/local.runsettings

Licença

MIT.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Keycloak.AdminSdk:

Package Downloads
Keycloak.AdminSdk.Diagnostics.Mcp

Optional read-only MCP diagnostics adapter for Keycloak.AdminSdk.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.1 89 6/22/2026

Initial preview with typed administration modules, resilience, realm contexts and optional observability.