Skip to content

Commit 6655af9

Browse files
authored
dotnet format (#425)
* Added pragmas * dotnet format * Disabled var_elsewhere * Adding dotnet format to pipeline * Added command to mac/linux too * Remove format from windows because of changes to csproj?
1 parent 2b0fe71 commit 6655af9

File tree

83 files changed

+439
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+439
-400
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ dotnet_style_explicit_tuple_names = true:suggestion
6060
[*.cs]
6161
# Prefer "var" when the type is apparent on the right side of the assignment; otherwise, avoid it.
6262
csharp_style_var_when_type_is_apparent = true:suggestion
63-
csharp_style_var_elsewhere = true:suggestion
63+
csharp_style_var_elsewhere = false:none
6464

6565
# Prefer method-like constructs to have a block body
6666
csharp_style_expression_bodied_methods = false:none

BlazorWasmDemo/Client/Shared/UserService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class UserService
1414
private const string _routeRegister = "credential";
1515
private const string _routeAssertionOpts = "assertion-options";
1616
private const string _routeLogin = "assertion";
17-
17+
1818
private readonly JsonSerializerOptions _jsonOptions = new FidoBlazorSerializerContext().Options;
1919
private readonly HttpClient _httpClient;
2020
private readonly WebAuthn _webAuthn;
@@ -103,7 +103,7 @@ public async Task<string> RegisterAsync(string? username, string? displayName =
103103
{
104104
Console.WriteLine(e);
105105
var errorMessage = e.Message;
106-
if(options.ExcludeCredentials?.Count > 0)
106+
if (options.ExcludeCredentials?.Count > 0)
107107
{
108108
errorMessage += " (You may have already registered this device)";
109109
}

BlazorWasmDemo/Server/Controllers/UserController.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,16 @@ public AssertionOptions MakeAssertionOptions([FromRoute] string? username, [From
213213

214214
var exts = new AuthenticationExtensionsClientInputs()
215215
{
216-
UserVerificationMethod = true,
217-
Extensions = true,
218-
DevicePubKey = new AuthenticationExtensionsDevicePublicKeyInputs()
216+
UserVerificationMethod = true,
217+
Extensions = true,
218+
DevicePubKey = new AuthenticationExtensionsDevicePublicKeyInputs()
219219
};
220220

221-
// 2. Create options (usernameless users will be prompted by their device to select a credential from their own list)
222-
var options = _fido2.GetAssertionOptions(
223-
existingKeys,
224-
userVerification ?? UserVerificationRequirement.Discouraged,
225-
exts);
221+
// 2. Create options (usernameless users will be prompted by their device to select a credential from their own list)
222+
var options = _fido2.GetAssertionOptions(
223+
existingKeys,
224+
userVerification ?? UserVerificationRequirement.Discouraged,
225+
exts);
226226

227227
// 4. Temporarily store options, session/in-memory cache/redis/db
228228
_pendingAssertions[new string(options.Challenge.Select(b => (char)b).ToArray())] = options;
@@ -300,7 +300,7 @@ public async Task<string> MakeAssertionAsync([FromBody] AuthenticatorAssertionRa
300300
var token = handler.CreateEncodedJwt(
301301
HttpContext.Request.Host.Host,
302302
HttpContext.Request.Headers.Referer,
303-
new ClaimsIdentity(new Claim[]{new(ClaimTypes.Actor, Encoding.UTF8.GetString(creds.UserHandle))}),
303+
new ClaimsIdentity(new Claim[] { new(ClaimTypes.Actor, Encoding.UTF8.GetString(creds.UserHandle)) }),
304304
DateTime.Now.Subtract(TimeSpan.FromMinutes(1)),
305305
DateTime.Now.AddDays(1),
306306
DateTime.Now,

Demo/ConformanceTesting.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Fido2Demo;
66

77
public static class ConformanceTesting
88
{
9-
private static readonly object _syncRoot = new ();
9+
private static readonly object _syncRoot = new();
1010

1111
private static IMetadataService _instance;
1212

Demo/Pages/_options.cshtml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
@@ -13,4 +13,4 @@ public void OnGet()
1313
{
1414
}
1515
}
16-
}
16+
}

Demo/TestController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Fido2Demo;
1717
public class TestController : Controller
1818
{
1919
/* CONFORMANCE TESTING ENDPOINTS */
20-
private static readonly DevelopmentInMemoryStore _demoStorage = new ();
20+
private static readonly DevelopmentInMemoryStore _demoStorage = new();
2121

2222
private readonly IFido2 _fido2;
2323
private readonly string _origin;
@@ -31,7 +31,7 @@ public TestController(IOptions<Fido2Configuration> fido2Configuration)
3131
ServerDomain = fido2Configuration.Value.ServerDomain,
3232
ServerName = fido2Configuration.Value.ServerName,
3333
Origins = fido2Configuration.Value.FullyQualifiedOrigins,
34-
},
34+
},
3535
ConformanceTesting.MetadataServiceInstance(
3636
System.IO.Path.Combine(fido2Configuration.Value.MDSCacheDirPath, @"Conformance"), _origin)
3737
);
@@ -130,7 +130,7 @@ public IActionResult AssertionOptionsTest([FromBody] TEST_AssertionClientParams
130130
uv = assertionClientParams.authenticatorSelection.UserVerification;
131131

132132
var exts = new AuthenticationExtensionsClientInputs
133-
{
133+
{
134134
AppID = _origin,
135135
UserVerificationMethod = true
136136
};

Src/Fido2.AspNet/DistributedCacheMetadataService.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ protected virtual DateTimeOffset GetMemoryCacheAbsoluteExpiryTime(DateTimeOffset
7676
var expiryTime = _systemClock.UtcNow.GetNextIncrement(_defaultMemoryCacheInterval);
7777

7878
//Ensure that memory cache expiry time never exceeds the next update time from the service
79-
if(nextUpdateTime.HasValue && expiryTime > nextUpdateTime.Value) expiryTime = nextUpdateTime.Value;
79+
if (nextUpdateTime.HasValue && expiryTime > nextUpdateTime.Value)
80+
expiryTime = nextUpdateTime.Value;
8081

8182
return expiryTime;
8283
}
@@ -98,7 +99,7 @@ protected virtual async Task<MetadataBLOBPayload> GetRepositoryPayloadWithErrorH
9899
{
99100
return await repository.GetBLOBAsync(cancellationToken);
100101
}
101-
catch(Exception ex)
102+
catch (Exception ex)
102103
{
103104
_logger.LogError(ex, "Could not fetch metadata from {0}", repository.GetType().Name);
104105
return null;
@@ -113,7 +114,7 @@ await _distributedCache.SetStringAsync(
113114
new DistributedCacheEntryOptions()
114115
{
115116
AbsoluteExpiration = GetDistributedCacheAbsoluteExpiryTime(GetNextUpdateTimeFromPayload(payload))
116-
},
117+
},
117118
cancellationToken);
118119
}
119120

@@ -165,7 +166,7 @@ protected virtual async Task<MetadataBLOBPayload> GetMemoryCachedPayload(IMetada
165166
{
166167
var distributedCacheBlob = await GetDistributedCachedBlob(repository, cancellationToken);
167168

168-
if(distributedCacheBlob != null)
169+
if (distributedCacheBlob != null)
169170
{
170171
var nextUpdateTime = GetNextUpdateTimeFromPayload(distributedCacheBlob);
171172

Src/Fido2.AspNet/Fido2NetLibBuilderExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static IFido2MetadataServiceBuilder AddFileSystemMetadataRepository(this
6262

6363
public static IFido2MetadataServiceBuilder AddConformanceMetadataRepository(
6464
this IFido2MetadataServiceBuilder builder,
65-
HttpClient client = null,
65+
HttpClient client = null,
6666
string origin = "")
6767
{
6868
builder.Services.AddTransient<IMetadataRepository>(provider =>
@@ -77,7 +77,8 @@ public static IFido2MetadataServiceBuilder AddFidoMetadataRepository(this IFido2
7777
{
7878
var httpClientBuilder = builder.Services.AddHttpClient(nameof(Fido2MetadataServiceRepository));
7979

80-
if(clientBuilder != null) clientBuilder(httpClientBuilder);
80+
if (clientBuilder != null)
81+
clientBuilder(httpClientBuilder);
8182

8283
builder.Services.AddTransient<IMetadataRepository, Fido2MetadataServiceRepository>();
8384

Src/Fido2.Ctap2/Commands/AuthenticatorClientPinCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public AuthenticatorClientPinCommand(
1313
byte[]? newPinEnc = null,
1414
byte[]? pinHashEnc = null)
1515
{
16-
16+
1717
PinProtocol = pinProtocol;
1818
SubCommand = subCommand;
1919
KeyAgreement = keyAgreement;
2020
PinAuth = pinAuth;
21-
NewPinEnc = newPinEnc;
21+
NewPinEnc = newPinEnc;
2222
PinHashEnc = pinHashEnc;
2323
}
2424

@@ -96,6 +96,7 @@ public AuthenticatorClientPinCommand(
9696

9797
public enum AuthenticatorClientPinSubCommand
9898
{
99+
#pragma warning disable format
99100
GetRetries = 0x01,
100101
GetKeyAgreement = 0x02,
101102
SetPin = 0x03,

Src/Fido2.Ctap2/Commands/AuthenticatorGetAssertionCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Fido2NetLib.Ctap2;
66
public sealed class AuthenticatorGetAssertionCommand : CtapCommand
77
{
88
public AuthenticatorGetAssertionCommand(
9-
string rpId,
9+
string rpId,
1010
byte[] clientDataHash,
1111
PublicKeyCredentialDescriptor[] allowList,
1212
CborMap? extensions = null,

0 commit comments

Comments
 (0)