RhbkSdk 8.2.7

dotnet add package RhbkSdk --version 8.2.7
                    
NuGet\Install-Package RhbkSdk -Version 8.2.7
                    
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="RhbkSdk" Version="8.2.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RhbkSdk" Version="8.2.7" />
                    
Directory.Packages.props
<PackageReference Include="RhbkSdk" />
                    
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 RhbkSdk --version 8.2.7
                    
#r "nuget: RhbkSdk, 8.2.7"
                    
#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 RhbkSdk@8.2.7
                    
#: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=RhbkSdk&version=8.2.7
                    
Install as a Cake Addin
#tool nuget:?package=RhbkSdk&version=8.2.7
                    
Install as a Cake Tool

RhbkSdk

O RhbkSdk é um SDK para .NET 8 que facilita a integração com a API RHBK (Keycloak), oferecendo uma camada de abstração moderna com suporte a grupos, papéis, autenticação e gerenciamento de usuários.


📦 Injeção de Dependência

Registre o SDK no seu Program.cs:

using RhbkSdk.Extensions;

builder.AddRhbkClient("https://seu.keycloak.url", ServiceLifetime.Scoped);

⚙️ Configuração por appsettings

Recomendado usar a classe RhbkConfiguration:

"RhbkConfiguration": {
  "Realm": "meu-realm",
  "ClientId": "client-id",
  "ClientSecret": "segredo",
  "KeycloakBaseUrl": "https://keycloak.meuservidor.com",
  "RedirectUri": "https://meusite/callback"
}

E carregar no startup:

builder.Services.Configure<RhbkConfiguration>(
    builder.Configuration.GetSection(RhbkConfiguration.ConfigurationSection));

📘 Como Usar

Você injeta a interface IRhbkClient diretamente:

public class MeuServico
{
    private readonly IRhbkClient _rhbkClient;

    public MeuServico(IRhbkClient rhbkClient)
    {
        _rhbkClient = rhbkClient;
    }

    public async Task<IList<UserResponse>> BuscarUsuarios()
    {
        var token = await _rhbkClient.GetTokenAsync("realm", new GetTokenRequestBody { ... });
        var usuarios = await _rhbkClient.GetUsersAsync(token.Data?.AccessToken!, "realm");

        return usuarios.Data ?? [];
    }
}

🧪 Retorno Padrão

Todas as chamadas assíncronas retornam:

DefaultResponseBody<T>

Esse objeto inclui:

  • StatusCode: código HTTP da operação
  • Data: resultado da chamada, que pode ser nulo

📂 Models disponíveis

  • Access
  • ClientResponse
  • GroupResponse
  • UserResponse
  • RoleResponse
  • RoleGroupMapping
  • GetTokenResponseBody
  • GroupCreateRequestBody
  • ClientRoleRequestBody
  • GroupRoleManagementRequestBody
  • RhbkConfiguration

✅ Funcionalidades

🔐 Autenticação

  • GetTokenAsync
  • GetLoginUrl
  • GetLogoutUrl
  • GetLoginProviderUrl

👥 Grupos

  • Criar grupos e subgrupos
  • Buscar todos os grupos ou subgrupos
  • Buscar membros
  • Adicionar/remover papéis de grupos
  • Deletar grupos

🧑‍💼 Usuários

  • Listar usuários
  • Adicionar usuário a grupo
  • Remover usuário de grupo

🧩 Clientes

  • Buscar cliente por nome
  • Gerenciar papéis do cliente

🔗 Dependências


🚀 CI/CD Automatizado

Este projeto possui pipeline com GitHub Actions que:

  • Compila
  • Empacota o .nupkg
  • Publica automaticamente no NuGet

Como publicar:

  1. Altere a versão no csproj (se necessário)
  2. Faça o commit
  3. Crie e envie uma tag:
git tag v8.0.2
git push origin v8.0.2

O pacote será publicado com a versão v8.0.2.


📝 Licença

Distribuído sob a licença MIT.
Consulte o arquivo LICENSE.txt para mais detalhes.


👨‍💻 Autor

Desenvolvido por Wallace Vidal de Figueiredo Fortuna
GitHub - wallacevff

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.2.7 392 6/26/2025
8.2.6 120 6/26/2025
8.2.5 123 6/26/2025
8.2.4 122 6/26/2025
8.2.3 154 6/17/2025
8.2.2 127 6/17/2025
8.2.1 368 5/15/2025
8.2.0 216 5/15/2025
8.1.0 216 5/15/2025