![]() |
VOOZH | about |
dotnet add package Keycloak.AuthServices.Authentication --version 3.0.0
NuGet\Install-Package Keycloak.AuthServices.Authentication -Version 3.0.0
<PackageReference Include="Keycloak.AuthServices.Authentication" Version="3.0.0" />
<PackageVersion Include="Keycloak.AuthServices.Authentication" Version="3.0.0" />Directory.Packages.props
<PackageReference Include="Keycloak.AuthServices.Authentication" />Project file
paket add Keycloak.AuthServices.Authentication --version 3.0.0
#r "nuget: Keycloak.AuthServices.Authentication, 3.0.0"
#:package Keycloak.AuthServices.Authentication@3.0.0
#addin nuget:?package=Keycloak.AuthServices.Authentication&version=3.0.0Install as a Cake Addin
#tool nuget:?package=Keycloak.AuthServices.Authentication&version=3.0.0Install as a Cake Tool
👁 Discord
👁 Build
👁 NuGet
👁 contributionswelcome
👁 Conventional Commits
👁 License
🔐 Easy Authentication and Authorization with Keycloak in .NET.
| Package | Version | Description |
|---|---|---|
Keycloak.AuthServices.Authentication |
👁 Nuget |
Keycloak Authentication JWT + OIDC |
Keycloak.AuthServices.Authorization |
👁 Nuget |
Authorization Services. Use Keycloak as authorization server |
Keycloak.AuthServices.Authorization.TokenIntrospection |
👁 Nuget |
Token introspection for lightweight access tokens (KC 24+) |
Keycloak.AuthServices.Authorization.Uma |
👁 Nuget |
UMA 2.0 support — permission ticket challenges, RPT exchange |
Keycloak.AuthServices.Sdk |
👁 Nuget |
HTTP API integration with Keycloak |
Keycloak.AuthServices.Sdk.Kiota |
👁 Nuget |
HTTP API integration with Keycloak based on OpenAPI |
Keycloak.AuthServices.OpenTelemetry |
👁 Nuget |
OpenTelemetry support |
Keycloak.AuthServices.Templates |
👁 Nuget |
dotnet new templates |
For Developer Documentation see: https://nikiforovall.github.io/keycloak-authorization-services-dotnet
See: https://nikiforovall.github.io/keycloak-authorization-services-dotnet-docs
Install packages:
dotnet add package Keycloak.AuthServices.Authentication
// Program.cs
using Keycloak.AuthServices.Authentication;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddKeycloakWebApiAuthentication(builder.Configuration);
builder.Services.AddAuthorization();
var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/", () => "Hello World!").RequireAuthorization();
app.Run();
In this example, configuration is based on appsettings.json.
//appsettings.json
{
"Keycloak": {
"realm": "Test",
"auth-server-url": "http://localhost:8080/",
"ssl-required": "none",
"resource": "test-client",
"verify-token-audience": false,
"credentials": {
"secret": ""
},
"confidential-port": 0
}
}
With Keycloak.AuthServices.Authorization, you can implement role-based authorization in your application. This package allows you to define policies based on roles. Also, you can use Keycloak as Authorization Server. It is a powerful way to organize and apply authorization polices centrally.
var builder = WebApplication.CreateBuilder(args);
var host = builder.Host;
var configuration = builder.Configuration;
var services = builder.Services;
services.AddKeycloakWebApiAuthentication(configuration);
services.AddAuthorization(options =>
{
options.AddPolicy("AdminAndUser", builder =>
{
builder
.RequireRealmRoles("User") // Realm role is fetched from token
.RequireResourceRoles("Admin"); // Resource/Client role is fetched from token
});
})
.AddKeycloakAuthorization(configuration);
var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/hello", () => "[]")
.RequireAuthorization("AdminAndUser");
app.Run();
var services = new ServiceCollection();
services.AddKeycloakAdminHttpClient(new KeycloakAdminClientOptions
{
AuthServerUrl = "http://localhost:8080/",
Realm = "master",
Resource = "admin-api",
});
var sp = services.BuildServiceProvider();
var client = sp.GetRequiredService<IKeycloakRealmClient>();
var realm = await client.GetRealmAsync("Test");
dotnet cake --target build
dotnet cake --target test
dotnet pack -o ./Artefacts
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Keycloak.AuthServices.Authentication:
| Package | Downloads |
|---|---|
|
Gathrr.Framework.Infrastructure
Package Description |
|
|
Feijuca.Auth
Feijuca.Auth simplifies Keycloak integration for user management and multi-tenancy. It features TokenManager for centralized API calls to manage users and auth services for handling multiple tenants using Keycloak realms. Check the documentation for more details! |
|
|
Manjalabs.Library
Package Description |
|
|
Iskra.Core.Auth
Настройка авторизации в Keycloak. |
|
|
Iskra.Core.ApiDocumentation
Формирование Swagger документации с настройкой авторизации. |
Showing the top 1 popular GitHub repositories that depend on Keycloak.AuthServices.Authentication:
| Repository | Stars |
|---|---|
|
mehmetozkaya/EshopModularMonoliths
Modular Monoliths on .NET used ASP.NET Web API, Docker, PostgreSQL, Redis, RabbitMQ, Keycloak, Seq, MassTransit, Entity Framework Core, CQRS, MediatR, DDD, Vertical Slice Architecture and Outbox pattern implementation with using latest features of .NET 8 and C# 12
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0 | 38,984 | 5/2/2026 |
| 3.0.0-rc.1 | 597 | 4/14/2026 |
| 2.10.0-rc.1 | 269 | 4/13/2026 |
| 2.9.0 | 55,474 | 3/27/2026 |
| 2.8.1 | 12,842 | 3/22/2026 |
| 2.8.0 | 128,861 | 12/25/2025 |
| 2.7.0 | 234,875 | 9/4/2025 |
| 2.6.1 | 369,355 | 3/13/2025 |
| 2.6.0 | 306,534 | 11/30/2024 |
| 2.5.3 | 587,302 | 8/19/2024 |
| 2.5.2 | 216,897 | 6/15/2024 |
| 2.5.1 | 22,812 | 6/11/2024 |
| 2.5.0 | 23,294 | 6/2/2024 |
| 2.4.1 | 39,819 | 5/16/2024 |
| 2.4.0 | 5,296 | 5/12/2024 |
| 2.3.0 | 2,039 | 5/10/2024 |
| 2.3.0-pre-1 | 220 | 5/9/2024 |
| 2.2.1 | 1,816 | 5/9/2024 |
| 2.2.0 | 1,766 | 5/8/2024 |
The release notes are available at https://github.com/NikiforovAll/keycloak-authorization-services-dotnet/releases