Skip to content

Commit f82c261

Browse files
Merge pull request #307 from DuendeSoftware/ev/atm/authority-in-samples
explicitly set audience in samples
2 parents e1044ed + 0e7b573 commit f82c261

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

access-token-management/samples/WebJarJwt/ClientAssertionService.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ public ClientAssertionService(
4646
var descriptor = new SecurityTokenDescriptor
4747
{
4848
Issuer = config.ClientId.ToString(),
49-
Audience = config.TokenEndpoint.GetLeftPart(UriPartial.Authority),
49+
50+
// Don't use the TokenEndpoint here. Use the Authority as the audience.
51+
// You may expose yourself to a vulnerability, as described in the document below:
52+
// https://openid.net/wp-content/uploads/2025/01/OIDF-Responsible-Disclosure-Notice-on-Security-Vulnerability-for-private_key_jwt.pdf
53+
Audience = "https://demo.duendesoftware.com",
5054
Expires = DateTime.UtcNow.AddMinutes(1),
5155
SigningCredentials = Credential,
5256

@@ -87,7 +91,11 @@ public async Task<string> SignAuthorizeRequest(OpenIdConnectMessage message,
8791
var descriptor = new SecurityTokenDescriptor
8892
{
8993
Issuer = config.ClientId.ToString(),
90-
Audience = config.TokenEndpoint.GetLeftPart(UriPartial.Authority),
94+
95+
// Don't use the TokenEndpoint here. Use the Authority as the audience.
96+
// You may expose yourself to a vulnerability, as described in the document below:
97+
// https://openid.net/wp-content/uploads/2025/01/OIDF-Responsible-Disclosure-Notice-on-Security-Vulnerability-for-private_key_jwt.pdf
98+
Audience = "https://demo.duendesoftware.com",
9199
Expires = DateTime.UtcNow.AddMinutes(1),
92100
SigningCredentials = Credential,
93101

access-token-management/samples/Worker/ClientAssertionService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ClientAssertionService(IOptionsMonitor<ClientCredentialsClient> opt
4040
var descriptor = new SecurityTokenDescriptor
4141
{
4242
Issuer = options1.ClientId?.ToString(),
43-
Audience = options1.TokenEndpoint?.ToString(),
43+
Audience = "https://demo.duendesoftware.com",
4444
Expires = DateTime.UtcNow.AddMinutes(1),
4545
SigningCredentials = Credential,
4646

access-token-management/samples/WorkerDI/ClientAssertionService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class ClientAssertionService(IOptionsMonitor<ClientCredentialsClient> opt
4040
var descriptor = new SecurityTokenDescriptor
4141
{
4242
Issuer = options1.ClientId!.ToString(),
43-
Audience = options1.TokenEndpoint!.ToString(),
43+
Audience = "https://demo.duendesoftware.com",
4444
Expires = DateTime.UtcNow.AddMinutes(1),
4545
SigningCredentials = Credential,
4646

0 commit comments

Comments
 (0)