Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.x
dotnet-version: 10.x
- name: Setup dotnet tools
run: dotnet tool restore
- name: Generate gRPC code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: true
matrix:
version:
- 8.x
- 10.x
steps:
- uses: actions/checkout@v6
- uses: bufbuild/buf-setup-action@v1
Expand Down
2 changes: 1 addition & 1 deletion examples/Zitadel.ApiAccess/Zitadel.ApiAccess.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/Zitadel.AspNet.AuthN/Zitadel.AspNet.AuthN.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion examples/Zitadel.WebApi/Zitadel.WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<IsPackable>false</IsPackable>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
5 changes: 4 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

default: clean generate-grpc

# Keep this in sync with `Zitadel.Api.ZitadelGrpcVersion.SupportedTag`.
zitadel_tag := "v4.15.0"

@clean:
rm -rf ./src/Zitadel/Api/Generated

generate-grpc:
buf generate https://github.com/zitadel/zitadel.git#depth=1 --include-imports --path ./proto/zitadel
buf generate https://github.com/zitadel/zitadel.git#ref={{zitadel_tag}},depth=1 --include-imports --path ./proto/zitadel
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand Down Expand Up @@ -42,7 +42,7 @@
Condition="$(MSBuildProjectExtension) == '.csproj'" />
<PackageReference
Include="SonarAnalyzer.CSharp"
Version="9.32.0.97167"
Version="10.23.0.137933"
PrivateAssets="all"
Condition="$(MSBuildProjectExtension) == '.csproj'" />
<PackageReference Include="Roslynator.Analyzers" Version="4.15.0" PrivateAssets="All" />
Expand Down
104 changes: 102 additions & 2 deletions src/Zitadel/Api/Clients.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
using Grpc.Core;
using Grpc.Net.Client;

using Zitadel.Action.V2;
using Zitadel.Admin.V1;
using Zitadel.Analytics.V2beta;
using Zitadel.Application.V2;
using Zitadel.Auth.V1;
using Zitadel.Authentication;
using Zitadel.Authorization.V2;
using Zitadel.Feature.V2;
using Zitadel.Idp.V2;
using Zitadel.Instance.V2;
using Zitadel.InternalPermission.V2;
using Zitadel.Management.V1;
using Zitadel.Oidc.V2;
using Zitadel.Org.V2;
using Zitadel.Project.V2;
using Zitadel.Saml.V2;
using Zitadel.Session.V2;
using Zitadel.Settings.V2;
using Zitadel.System.V1;
using Zitadel.User.V2;
using Zitadel.Webkey.V2;

namespace Zitadel.Api;

/// <summary>
/// Helper class to instantiate (gRPC) api service clients for the ZITADEL API with correct settings.
/// All other versions are still available, but the latest version is used by default.
/// Provides static methods to create and configure instances of gRPC API service clients for the ZITADEL API.
/// The clients are instantiated with default or specified options to ensure proper connectivity and authentication.
/// </summary>
public static class Clients
{
Expand Down Expand Up @@ -44,6 +55,70 @@ public static AuthService.AuthServiceClient AuthService(Options options) =>
public static ManagementService.ManagementServiceClient ManagementService(Options options) =>
GetClient<ManagementService.ManagementServiceClient>(options);

/// <summary>
/// Create a service client for the application service.
/// </summary>
/// <param name="options">Options for the client, including endpoint and authorization method.</param>
/// <returns>The <see cref="Application.V2.ApplicationService.ApplicationServiceClient"/>.</returns>
public static ApplicationService.ApplicationServiceClient ApplicationService(Options options) =>
GetClient<ApplicationService.ApplicationServiceClient>(options);

/// <summary>
/// Create a service client for the project service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Project.V2.ProjectService.ProjectServiceClient"/>.</returns>
public static ProjectService.ProjectServiceClient ProjectService(Options options) =>
GetClient<ProjectService.ProjectServiceClient>(options);

/// <summary>
/// Create a service client for the action service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Action.V2.ActionService.ActionServiceClient"/>.</returns>
public static ActionService.ActionServiceClient ActionService(Options options) =>
GetClient<ActionService.ActionServiceClient>(options);

/// <summary>
/// Create a service client for the authorization service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Authorization.V2.AuthorizationService.AuthorizationServiceClient"/>.</returns>
public static AuthorizationService.AuthorizationServiceClient AuthorizationService(Options options) =>
GetClient<AuthorizationService.AuthorizationServiceClient>(options);

/// <summary>
/// Create a service client for the feature service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Feature.V2.FeatureService.FeatureServiceClient"/>.</returns>
public static FeatureService.FeatureServiceClient FeatureService(Options options) =>
GetClient<FeatureService.FeatureServiceClient>(options);

/// <summary>
/// Create a service client for the telemetry service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="TelemetryService.TelemetryServiceClient"/>.</returns>
public static TelemetryService.TelemetryServiceClient TelemetryService(Options options) =>
GetClient<TelemetryService.TelemetryServiceClient>(options);

/// <summary>
/// Create a service client for the SAML service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Saml.V2.SAMLService.SAMLServiceClient"/>.</returns>
public static SAMLService.SAMLServiceClient SAMLService(Options options) =>
GetClient<SAMLService.SAMLServiceClient>(options);

/// <summary>
/// Create a service client for the web key service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Webkey.V2.WebKeyService.WebKeyServiceClient"/>.</returns>
public static WebKeyService.WebKeyServiceClient WebKeyService(Options options) =>
GetClient<WebKeyService.WebKeyServiceClient>(options);

/// <summary>
/// Create a service client for the oidc service.
/// </summary>
Expand Down Expand Up @@ -92,6 +167,31 @@ public static SystemService.SystemServiceClient SystemService(Options options) =
public static UserService.UserServiceClient UserService(Options options) =>
GetClient<UserService.UserServiceClient>(options);

/// <summary>
/// Create a service client for the identity provider service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="IdentityProviderService.IdentityProviderServiceClient"/>.</returns>
public static IdentityProviderService.IdentityProviderServiceClient IdentityProviderService(Options options) =>
GetClient<IdentityProviderService.IdentityProviderServiceClient>(options);

/// <summary>
/// Create a service client for the instance service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="Instance.V2.InstanceService.InstanceServiceClient"/>.</returns>
public static InstanceService.InstanceServiceClient InstanceService(Options options) =>
GetClient<InstanceService.InstanceServiceClient>(options);

/// <summary>
/// Create a service client for the internal permission service.
/// </summary>
/// <param name="options">Options for the client like authorization method.</param>
/// <returns>The <see cref="InternalPermission.V2.InternalPermissionService.InternalPermissionServiceClient"/>.</returns>
public static InternalPermissionService.InternalPermissionServiceClient
InternalPermissionService(Options options) =>
GetClient<InternalPermissionService.InternalPermissionServiceClient>(options);

private static TClient GetClient<TClient>(Options options)
where TClient : ClientBase<TClient>
{
Expand Down
12 changes: 12 additions & 0 deletions src/Zitadel/Api/ZitadelGrpcVersion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Zitadel.Api;

/// <summary>
/// Version information about the generated ZITADEL gRPC API clients in this package.
/// </summary>
public static class ZitadelGrpcVersion
{
/// <summary>
/// Upstream ZITADEL git tag used as source for protobuf generation.
/// </summary>
public const string SupportedTag = "v4.15.0";
}
6 changes: 3 additions & 3 deletions src/Zitadel/Zitadel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<PackageReference Include="jose-jwt" Version="5.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.26"/>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.26"/>
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="10.0.6" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="FluentAssertions" Version="8.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PackageReference Include="coverlet.collector" Version="8.0.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion tests/Zitadel.Test/Credentials/ServiceAccount.Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public async Task Should_Throw_With_Meaningful_Error()
var sa = await ServiceAccount.LoadFromJsonStringAsync(TestData.InvalidServiceAccountJson);
var ex = await Assert.ThrowsAsync<HttpRequestException>(() => sa.AuthenticateAsync(TestData.ApiUrl));

ex.Message.Should().Contain("Errors.Internal");
ex.Message.Should().Contain("invalid_grant");
}
}
10 changes: 5 additions & 5 deletions tests/Zitadel.Test/Zitadel.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.26" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.6" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Update="FluentAssertions" Version="6.12.2" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Update="FluentAssertions" Version="8.9.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageReference Update="xunit" Version="2.9.3" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.8.2">
<PackageReference Update="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="coverlet.collector" Version="6.0.4">
<PackageReference Update="coverlet.collector" Version="8.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading