Skip to content

Commit 1932124

Browse files
dotnet format
1 parent 7e67a05 commit 1932124

File tree

6 files changed

+39
-17
lines changed

6 files changed

+39
-17
lines changed

access-token-management/test/AccessTokenManagement.Tests/ClientTokenManagementTests.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,11 @@ public async Task dpop_nonce_retry_should_use_fresh_client_assertion()
627627
var content = m.Content!.ReadAsStringAsync().Result;
628628
var pairs = System.Web.HttpUtility.ParseQueryString(content);
629629
var assertion = pairs["client_assertion"];
630-
if (assertion != null) capturedAssertions.Add(assertion);
630+
if (assertion != null)
631+
{
632+
capturedAssertions.Add(assertion);
633+
}
634+
631635
return true;
632636
})
633637
.Respond(HttpStatusCode.BadRequest,
@@ -642,7 +646,11 @@ [new KeyValuePair<string, string>("DPoP-Nonce", "some_nonce")],
642646
var content = m.Content!.ReadAsStringAsync().Result;
643647
var pairs = System.Web.HttpUtility.ParseQueryString(content);
644648
var assertion = pairs["client_assertion"];
645-
if (assertion != null) capturedAssertions.Add(assertion);
649+
if (assertion != null)
650+
{
651+
capturedAssertions.Add(assertion);
652+
}
653+
646654
return true;
647655
})
648656
.Respond(_ => Some.TokenHttpResponse());

access-token-management/test/AccessTokenManagement.Tests/UserTokenManagementTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using Duende.AccessTokenManagement.OpenIdConnect;
99
using Duende.IdentityModel;
1010
using Duende.IdentityModel.Client;
11-
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
1211
using Microsoft.AspNetCore.Builder;
1312
using Microsoft.AspNetCore.Http;
1413
using Microsoft.Extensions.DependencyInjection;

access-token-management/test/AccessTokenManagement.Tests/UserTokenManagementWithDPoPTests.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ public async Task dpop_nonce_retry_should_use_fresh_client_assertion_on_refresh(
161161
var content = request.Content!.ReadAsStringAsync().Result;
162162
var pairs = System.Web.HttpUtility.ParseQueryString(content);
163163
var assertion = pairs["client_assertion"];
164-
if (assertion != null) capturedAssertions.Add(assertion);
164+
if (assertion != null)
165+
{
166+
capturedAssertions.Add(assertion);
167+
}
168+
165169
return true;
166170
})
167171
.Respond(HttpStatusCode.BadRequest, headers: new Dictionary<string, string>
@@ -186,7 +190,10 @@ public async Task dpop_nonce_retry_should_use_fresh_client_assertion_on_refresh(
186190
var content = request.Content!.ReadAsStringAsync().Result;
187191
var pairs = System.Web.HttpUtility.ParseQueryString(content);
188192
var assertion = pairs["client_assertion"];
189-
if (assertion != null) capturedAssertions.Add(assertion);
193+
if (assertion != null)
194+
{
195+
capturedAssertions.Add(assertion);
196+
}
190197

191198
// Also verify the nonce is in the DPoP proof
192199
var dpopProof = request.Headers.GetValues("DPoP").SingleOrDefault();
@@ -244,7 +251,11 @@ public async Task dpop_nonce_retry_during_code_exchange_should_use_fresh_client_
244251
var content = request.Content!.ReadAsStringAsync().Result;
245252
var pairs = System.Web.HttpUtility.ParseQueryString(content);
246253
var assertion = pairs["client_assertion"];
247-
if (assertion != null) capturedAssertions.Add(assertion);
254+
if (assertion != null)
255+
{
256+
capturedAssertions.Add(assertion);
257+
}
258+
248259
return true;
249260
})
250261
.Respond(HttpStatusCode.BadRequest, headers: new Dictionary<string, string>
@@ -269,7 +280,10 @@ public async Task dpop_nonce_retry_during_code_exchange_should_use_fresh_client_
269280
var content = request.Content!.ReadAsStringAsync().Result;
270281
var pairs = System.Web.HttpUtility.ParseQueryString(content);
271282
var assertion = pairs["client_assertion"];
272-
if (assertion != null) capturedAssertions.Add(assertion);
283+
if (assertion != null)
284+
{
285+
capturedAssertions.Add(assertion);
286+
}
273287

274288
// Verify the nonce is present in the DPoP proof
275289
var dpopProof = request.Headers.GetValues("DPoP").SingleOrDefault();
@@ -300,13 +314,10 @@ private class CountingClientAssertionService(Func<string> valueFactory) : IClien
300314
public Task<ClientAssertion?> GetClientAssertionAsync(
301315
ClientCredentialsClientName? clientName = null,
302316
TokenRequestParameters? parameters = null,
303-
CancellationToken ct = default)
304-
{
305-
return Task.FromResult<ClientAssertion?>(new ClientAssertion
317+
CancellationToken ct = default) => Task.FromResult<ClientAssertion?>(new ClientAssertion
306318
{
307319
Type = OidcConstants.ClientAssertionTypes.JwtBearer,
308320
Value = valueFactory()
309321
});
310-
}
311322
}
312323
}

identity-model-oidc-client/src/IdentityModel.OidcClient.Extensions/DPoP/OidcClientExtensions.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Duende Software. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33

4-
using Duende.IdentityModel.Client;
5-
64
namespace Duende.IdentityModel.OidcClient.DPoP;
75

86
/// <summary>

identity-model-oidc-client/src/IdentityModel.OidcClient.Extensions/DPoP/ProofTokenMessageHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ private async Task RebuildContentWithNewAssertionAsync(HttpRequestMessage reques
127127
// Parse the application/x-www-form-urlencoded body manually.
128128
// We use a list of pairs to preserve insertion order and multi-value keys.
129129
var pairs = new List<KeyValuePair<string, string>>();
130-
bool assertionTypeSet = false;
131-
bool assertionValueSet = false;
130+
var assertionTypeSet = false;
131+
var assertionValueSet = false;
132132

133133
if (!string.IsNullOrEmpty(bodyString))
134134
{

identity-model-oidc-client/test/IdentityModel.OidcClient.Tests/DPoP/DPoPTests.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ public async Task when_nonce_required_client_assertion_factory_should_be_called_
152152
: string.Empty;
153153
var pairs = HttpUtility.ParseQueryString(body);
154154
var assertion = pairs["client_assertion"];
155-
if (assertion != null) capturedAssertions.Add(assertion);
155+
if (assertion != null)
156+
{
157+
capturedAssertions.Add(assertion);
158+
}
156159

157160
callCount++;
158161
if (callCount == 1)
@@ -229,7 +232,10 @@ public async Task when_no_client_assertion_factory_nonce_retry_does_not_modify_b
229232
: string.Empty;
230233
var pairs = HttpUtility.ParseQueryString(body);
231234
var assertion = pairs["client_assertion"];
232-
if (assertion != null) capturedAssertions.Add(assertion);
235+
if (assertion != null)
236+
{
237+
capturedAssertions.Add(assertion);
238+
}
233239

234240
callCount++;
235241
if (callCount == 1)

0 commit comments

Comments
 (0)