Skip to content

Commit 96c9804

Browse files
authored
Merge pull request #223 from DuendeSoftware/mb/720
Add Strict Audience Validation to Private Key JWT samples
2 parents 225bb06 + e465933 commit 96c9804

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

IdentityServer/v7/Basics/IdentityServer/src/HostingExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde
2121
// see https://docs.duendesoftware.com/identityserver/v6/fundamentals/resources/api_scopes
2222
options.EmitStaticAudienceClaim = true;
2323
options.PushedAuthorization.AllowUnregisteredPushedRedirectUris = true;
24+
25+
options.Preview.StrictClientAssertionAudienceValidation = true;
2426
})
2527
.AddTestUsers(TestUsers.Users);
2628

@@ -68,4 +70,4 @@ public static WebApplication ConfigurePipeline(this WebApplication app)
6870

6971
return app;
7072
}
71-
}
73+
}

IdentityServer/v7/Basics/IdentityServer/src/IdentityServerHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Duende.IdentityServer" Version="7.1.0" />
9+
<PackageReference Include="Duende.IdentityServer" Version="7.2.0" />
1010
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
1111
</ItemGroup>
1212

IdentityServer/v7/Basics/JwtBasedClientAuthentication/src/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ static string CreateClientToken(SigningCredentials credential, string clientId,
7575
credential
7676
);
7777

78+
token.Header[JwtClaimTypes.TokenType] = "client-authentication+jwt";
79+
7880
var tokenHandler = new JwtSecurityTokenHandler();
7981
var clientToken = tokenHandler.WriteToken(token);
8082
"\n\nClient Authentication Token:".ConsoleGreen();
@@ -94,4 +96,4 @@ static async Task CallServiceAsync(string token)
9496

9597
"\n\nService claims:".ConsoleGreen();
9698
Console.WriteLine(response.PrettyPrintJson());
97-
}
99+
}

IdentityServer/v7/Basics/MvcJarJwt/src/AssertionService.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public string CreateClientToken()
4040
new SigningCredentials(new JsonWebKey(key), "RS256")
4141
);
4242

43+
token.Header[JwtClaimTypes.TokenType] = "client-authentication+jwt";
44+
4345
var tokenHandler = new JwtSecurityTokenHandler();
4446
tokenHandler.OutboundClaimTypeMap.Clear();
4547

0 commit comments

Comments
 (0)