This library is created to bring the Keycloak's fine-grained authorization to C#.
If you want to learn more about how to configure keycloak as an authorization server, check this video or if you are not a visual learner, check the official keycloak documentation.
This library is available in nuget and can be installed with the following command:
dotnet add package Keycloak.Authz.Net
Note: This is a dotnet 8 specific library.
Well if you already know how the legacy [Authorize]
attribute works, or how .RequireAuthorization()
extension method for endpoints works, then you will have no problem to switch to something much more complex, but simplified enough so you can use it exactly the same as before.
For example the attributes and extension methods are changed like this:
- [Authorize] -> [Authz]
- .RequireAuthorization() -> .RequireAuthz()
Now if you are interested, check out the Documentation
Anyone from the community is so welcomed to just jump in, fix things or add new features. I am maintaining this project just by myself, but will appreciate some help 😊
Just simply make a PR and we will check it out together.
Check the [Documentation] for more info about how to set it up.
For an example project, check example
For more information on Keycloak fine-grained authorization check:
- My video on it
- Keycloak official documentations.