Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NikiforovAll committed May 6, 2024
2 parents 24665b7 + 03f6f96 commit a86537f
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nikiforovall/keycloak-authorization-services-dotnet/blob/main/LICENSE.md)

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

| Package | Version | Description |
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
Expand Down Expand Up @@ -70,7 +70,7 @@ In this example, configuration is based on `appsettings.json`.
}
```

## Example Authorization
## Example - Add Authorization

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.

Expand Down Expand Up @@ -105,6 +105,23 @@ app.MapGet("/hello", () => "[]")
app.Run();
```

### Example - Invoke Admin API

```csharp
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");
```

## Build and Development

`dotnet cake --target build`
Expand Down

0 comments on commit a86537f

Please sign in to comment.