Skip to content

Commit

Permalink
feat: Add Kiota SDK for Admin API
Browse files Browse the repository at this point in the history
  • Loading branch information
NikiforovAll committed May 5, 2024
1 parent cf22078 commit bc7bd82
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 11 deletions.
7 changes: 7 additions & 0 deletions KeycloakAuthorizationServicesDotNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWebApi", "tests\TestWeb
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Keycloak.AuthServices.Authorization.Tests", "tests\Keycloak.AuthServices.Authorization.Tests\Keycloak.AuthServices.Authorization.Tests.csproj", "{331F4EF5-9CFE-4060-B903-69CCE9062BFD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Keycloak.AuthServices.Sdk.Kiota", "src\Keycloak.AuthServices.Sdk.Kiota\Keycloak.AuthServices.Sdk.Kiota.csproj", "{8C43A1C1-0069-4B21-ADDE-5268EB214820}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -142,6 +144,10 @@ Global
{331F4EF5-9CFE-4060-B903-69CCE9062BFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{331F4EF5-9CFE-4060-B903-69CCE9062BFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{331F4EF5-9CFE-4060-B903-69CCE9062BFD}.Release|Any CPU.Build.0 = Release|Any CPU
{8C43A1C1-0069-4B21-ADDE-5268EB214820}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C43A1C1-0069-4B21-ADDE-5268EB214820}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C43A1C1-0069-4B21-ADDE-5268EB214820}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C43A1C1-0069-4B21-ADDE-5268EB214820}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -165,6 +171,7 @@ Global
{7499F9F0-1132-46B4-AAA2-D60D9F113293} = {96857509-627A-4FD2-AC82-34387619A7B1}
{0F40EFE2-8D17-46B2-A91B-EC4BCB93E77C} = {96857509-627A-4FD2-AC82-34387619A7B1}
{331F4EF5-9CFE-4060-B903-69CCE9062BFD} = {96857509-627A-4FD2-AC82-34387619A7B1}
{8C43A1C1-0069-4B21-ADDE-5268EB214820} = {F9D5C5B8-9933-4AE0-ADAC-6B8C15F7552A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E1907BFD-C144-4B48-AA40-972F499D4E08}
Expand Down
3 changes: 0 additions & 3 deletions assets/install-keycloak.png

This file was deleted.

2 changes: 1 addition & 1 deletion docs/.vitepress/V1/Authentication.README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ For more details see an example - [Program.cs](../../samples/AuthorizationAndCle

"workspace-authz" is a "confidential client".

![install-keycloak](../../assets/install-keycloak.png)
<!-- ![install-keycloak](../../assets/install-keycloak.png) -->

Here is how non-confidential client installation configuration look like:
```csharp
Expand Down
4 changes: 4 additions & 0 deletions docs/admin-rest-api/admin-api-openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ From Keycloak documentation:
> The OpenAPI definitions are a feature that is currently in preview. Please provide your feedback by [joining this discussion](https://github.com/keycloak/keycloak/discussions/8898) while we’re continuing to work on this. If you find something is outdated or wrong, create a GitHub issue and provide a pull request.
It means we can use OpenAPI definitions to generate full-fledged API.

* <https://www.keycloak.org/docs-api/latest/rest-api/>
* <https://www.keycloak.org/docs-api/latest/rest-api/openapi.json>
* <https://www.keycloak.org/docs/latest/release_notes/>
3 changes: 3 additions & 0 deletions docs/public/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<PackageProjectUrl>https://github.com/NikiforovAll/keycloak-authorization-services-dotnet</PackageProjectUrl>
<RepositoryUrl>https://github.com/NikiforovAll/keycloak-authorization-services-dotnet</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<PackageReleaseNotes>The release notes are available at https://github.com/NikiforovAll/keycloak-authorization-services-dotnet/releases</PackageReleaseNotes>
</PropertyGroup>

Expand All @@ -24,6 +25,8 @@
<ItemGroup>
<!-- Include README.md to NuGet package -->
<None Include="../../README.md" Pack="true" PackagePath="\"/>
<!-- Include icon.png to NuGet package -->
<None Include="../../docs/public/icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>

<PropertyGroup Label="Build">
Expand Down
11 changes: 11 additions & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0"/>
</ItemGroup>

<ItemGroup Label="Kiota">
<PackageVersion Include="Microsoft.Kiota.Abstractions" Version="1.7.11" />
<PackageVersion Include="Microsoft.Kiota.Authentication.Azure" Version="1.1.4" />
<PackageVersion Include="Microsoft.Kiota.Http.HttpClientLibrary" Version="1.3.7" />
<PackageVersion Include="Microsoft.Kiota.Serialization.Form" Version="1.1.5" />
<PackageVersion Include="Microsoft.Kiota.Serialization.Json" Version="1.1.8" />
<PackageVersion Include="Microsoft.Kiota.Serialization.Multipart" Version="1.1.3" />
<PackageVersion Include="Microsoft.Kiota.Serialization.Text" Version="1.1.4" />
</ItemGroup>


<ItemGroup Label="Release">
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0"/>
<PackageVersion Include="MinVer" Version="5.0.0"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Keycloak.AuthServices.Sdk.Kiota</RootNamespace>
</PropertyGroup>

<PropertyGroup Label="Package">
<Product>Keycloak.AuthServices.Sdk.Kiota</Product>
<Description>Keycloak HTTP Admin API SDK</Description>
<PackageTags>Keycloak;SDK;HttpClient;KeycloakAdminAPI</PackageTags>
<MinVerSkip>true</MinVerSkip>
<Version>24.0.1</Version>
</PropertyGroup>



<ItemGroup>
<ProjectReference Include="..\Keycloak.AuthServices.Common\Keycloak.AuthServices.Common.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Kiota.Abstractions" />
<PackageReference Include="Microsoft.Kiota.Authentication.Azure" />
<PackageReference Include="Microsoft.Kiota.Http.HttpClientLibrary" />
<PackageReference Include="Microsoft.Kiota.Serialization.Form" />
<PackageReference Include="Microsoft.Kiota.Serialization.Json" />
<PackageReference Include="Microsoft.Kiota.Serialization.Multipart" />
<PackageReference Include="Microsoft.Kiota.Serialization.Text" />
</ItemGroup>

</Project>
14 changes: 14 additions & 0 deletions src/Keycloak.AuthServices.Sdk.Kiota/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Keycloak.AuthServices.Sdk.Kiota

## Generate Client

```bash
export KEYCLOAK_API_VERSION=24.0.1
kiota generate -l CSharp \
--log-level trace \
--output ./ \
--namespace-name Keycloak.AuthServices.Sdk.Kiota.Admin \
--class-name KeycloakAdminApiClient \
--exclude-backward-compatible \
--openapi https://www.keycloak.org/docs-api/$KEYCLOAK_API_VERSION/rest-api/openapi.json
```
2 changes: 1 addition & 1 deletion tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
</ItemGroup>

<PropertyGroup>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Alba" Version="7.4.1" />
<PackageReference Include="Duende.AccessTokenManagement" Version="2.1.2" />
Expand Down

0 comments on commit bc7bd82

Please sign in to comment.