Keycloak.AuthServices.Common 1.0.1

Keycloak.AuthServices

Build License contributionswelcome

Package Version Description
Keycloak.AuthServices.Authentication Nuget Keycloak Authentication JWT + OICD
Keycloak.AuthServices.Authorization Nuget Authorization Services. Use Keycloak as authorization server
Keycloak.AuthServices.Sdk Nuget HTTP API integration with Keycloak

Easy Authentication and Authorization with Keycloak in .NET and ASP.NET Core.

Keycloak.AuthServices.Authentication

Keycloak.AuthServices.Authentication

Add OpenID Connect + JWT Bearer token authentication.

// add configuration from keycloak file
host.ConfigureKeycloakConfigurationSource("keycloak.json");
// add authentication services, OICD JwtBearerDefaults.AuthenticationScheme
services.AddKeycloakAuthentication(configuration, o =>
{
    o.RequireHttpsMetadata = false;
});

Client roles are automatically transformed into user role claims KeycloakRolesClaimsTransformation.

See Keycloak.AuthServices.Authentication - README.md

Keycloak installation file:

// confidential client
{
  "realm": "<realm>",
  "auth-server-url": "http://localhost:8088/auth/",
  "ssl-required": "external", // external | none
  "resource": "<clientId>",
  "verify-token-audience": true,
  "credentials": {
    "secret": ""
  }
}
// public client
{
  "realm": "<realm>",
  "auth-server-url": "http://localhost:8088/auth/",
  "ssl-required": "external",
  "resource": "<clientId>",
  "public-client": true,
  "confidential-port": 0
}

Keycloak.AuthServices.Authorization

Keycloak.AuthServices.Authorization

services.AddAuthorization(authOptions =>
{
    authOptions.AddPolicy("<policyName>", policyBuilder =>
    {
        // configure policies here
    });
}).AddKeycloakAuthorization(configuration);

See Keycloak.AuthServices.Authorization - README.md

Keycloak.AuthServices.Sdk

Keycloak.AuthServices.Sdk

Keycloak API clients.

Service Description
IKeycloakClient Unified HTTP client - IKeycloakRealmClient, IKeycloakProtectedResourceClient
IKeycloakRealmClient Keycloak realm API
IKeycloakProtectedResourceClient Protected resource API
IKeycloakProtectionClient Authorization server API, used by AddKeycloakAuthorization
// requires confidential client
services.AddKeycloakAdminHttpClient(keycloakOptions);

// based on token forwarding HttpClient middleware and IHttpContextAccessor
services.AddKeycloakProtectionHttpClient(keycloakOptions);

See Keycloak.AuthServices.Sdk - README.md

Build and Development

dotnet cake --target build

dotnet pack -o ./Artefacts

Reference

No packages depend on Keycloak.AuthServices.Common.

.NET 6.0

  • No dependencies.

Version Downloads Last updated
3.0.0 2 06.05.2026
3.0.0-rc.1 2 29.04.2026
2.10.0-rc.1 2 27.04.2026
2.9.0 2 31.03.2026
2.8.1 2 23.03.2026
2.8.0 3 11.02.2026
2.7.0 6 25.09.2025
2.6.1 8 04.06.2025
2.6.0 8 04.06.2025
2.5.5 8 04.06.2025
2.5.3 9 29.04.2025
2.5.2 8 04.06.2025
2.5.1 9 04.06.2025
2.5.0 8 04.06.2025
2.4.1 8 04.06.2025
2.4.0 8 04.06.2025
2.3.0 8 04.06.2025
2.3.0-pre-1 8 04.06.2025
2.2.1 8 04.06.2025
2.2.0 8 04.06.2025
2.1.0 8 04.06.2025
2.0.0 8 04.06.2025
2.0.0-pre-4 8 04.06.2025
2.0.0-pre-3 8 04.06.2025
2.0.0-pre-2 8 04.06.2025
2.0.0-pre-1 8 04.06.2025
1.7.0 8 04.06.2025
1.6.0 8 04.06.2025
1.5.2 8 04.06.2025
1.5.1 7 04.06.2025
1.5.0 8 04.06.2025
1.4.1 8 26.05.2025
1.4.0 8 04.06.2025
1.3.0 8 04.06.2025
1.2.1 8 04.06.2025
1.2.0 8 04.06.2025
1.1.0 8 04.06.2025
1.0.5 8 04.06.2025
1.0.4 8 04.06.2025
1.0.3 8 04.06.2025
1.0.2 8 04.06.2025
1.0.1 8 04.06.2025