Skip to content
Draft
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 Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageVersion Include="Grpc" Version="2.46.6" />
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.80.0" />
<PackageVersion Include="Grpc.Net.Common" Version="2.80.0" />
<PackageVersion Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="6.2.0" />
<PackageVersion Include="Duende.AspNetCore.Authentication.OAuth2Introspection" Version="7.0.1" />
<PackageVersion Include="jose-jwt" Version="5.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.8" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="10.0.8" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using IdentityModel.AspNetCore.OAuth2Introspection;
using Duende.AspNetCore.Authentication.OAuth2Introspection;

namespace Zitadel.Authentication.Options;

Expand Down
13 changes: 10 additions & 3 deletions src/Zitadel/Extensions/ApplicationBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System.Security.Claims;
using System.Text.Json;

using IdentityModel.Client;
using Duende.AspNetCore.Authentication.OAuth2Introspection;
using Duende.IdentityModel.Client;

using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OAuth.Claims;
Expand Down Expand Up @@ -157,7 +158,6 @@ public static AuthenticationBuilder AddZitadelIntrospection(
options.ClientId = zitadelOptions.ClientId;
options.ClientSecret = zitadelOptions.ClientSecret;
options.DiscoveryPolicy = zitadelOptions.DiscoveryPolicy;
options.EnableCaching = zitadelOptions.EnableCaching;
options.IntrospectionEndpoint = zitadelOptions.IntrospectionEndpoint;
options.SaveToken = zitadelOptions.SaveToken;
options.TokenRetriever = zitadelOptions.TokenRetriever;
Expand Down Expand Up @@ -222,9 +222,16 @@ public static AuthenticationBuilder AddZitadelIntrospection(
options.ClientId = null;
options.ClientSecret = null;
options.ClientCredentialStyle = ClientCredentialStyle.PostBody;
var authority = options.Authority;
if (string.IsNullOrWhiteSpace(authority))
{
throw new InvalidOperationException(
"Authority must be configured when JwtProfile is used for introspection.");
}

options.Events.OnUpdateClientAssertion += async context =>
{
var jwt = await zitadelOptions.JwtProfile.GetSignedJwtAsync(options.Authority);
var jwt = await zitadelOptions.JwtProfile.GetSignedJwtAsync(authority);
context.ClientAssertion = new()
{
Type = ZitadelIntrospectionOptions.JwtBearerClientAssertionType,
Expand Down
2 changes: 1 addition & 1 deletion src/Zitadel/Zitadel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="Grpc" />
<PackageReference Include="Grpc.Net.ClientFactory" />
<PackageReference Include="Grpc.Net.Common" />
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" />
<PackageReference Include="Duende.AspNetCore.Authentication.OAuth2Introspection" />
<PackageReference Include="jose-jwt" />
</ItemGroup>

Expand Down
Loading