A Fork of https://github.com/lvermeulen/Keycloak.Net with some additional patches
- allow usage of CancellationTokens
- changed ClientConfig to Dictionary<string, string>
- removed signing
- .NET 8 and .NET 10 support only
- updated for keycloak version 26+
- added support for changing default
AdminClientIdwhich has defaultadmin-clivalue - added support for System.Text.Json in replacement of NewtonsoftJson.
To use different AdminClientId, use newly introduced KeyCloakOptions:
new KeycloakClient(
"http://keycloak.url",
"adminUserName",
"adminPassword",
new KeycloakOptions(adminClientId:"admin"
)
);When creating a new KeycloakClient, use newly introduced KeycloakOptions:
new KeycloakClient(
"http://keycloak.url",
"adminUserName",
"adminPassword",
new KeycloakOptions(prefix:"auth"
)
);C# client for Keycloak 26.x
See documentation at https://www.keycloak.org/docs-api/latest/rest-api/
- Attack Detection
- Authentication Management
- Client Attribute Certificate
- Client Initial Access
- Client Registration Policy
- Client Role Mappings
- Client Scopes
- Clients
- Component
- Groups
- Identity Providers
- Key
- Protocol Mappers
- Realms Admin
- Role Mapper
- Roles
- Roles (by ID)
- Scope Mappings
- User Storage Provider
- Users
- Root
The easiest way to run the tests is to use the fixture launcher:
./build/start-keycloak.sh --test --auto-cleanupThis starts Keycloak 26.7.0 in Docker, imports /test/keycloak-net-fixture-realm-export.json, runs the tests, and removes the container when the run completes.
To start the fixture server without running tests:
./build/start-keycloak.shThe fixture realm is keycloak-net-fixture. The tests use the credentials in /test/Keycloak.Net.Core.Tests/appsettings.json; the fixture export includes the matching realm admin user.
If you prefer to run Keycloak manually, import /test/keycloak-net-fixture-realm-export.json into a Keycloak 26.7.0 instance before running the tests. The imported realm must be available at keycloak-net-fixture, and the credentials in /test/Keycloak.Net.Core.Tests/appsettings.json must match the realm admin user included in the export.