Skip to content

Commit 2a27424

Browse files
updated
1 parent 70a286d commit 2a27424

File tree

322 files changed

+20232
-3064
lines changed

Some content is hidden

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

322 files changed

+20232
-3064
lines changed

.github/workflow-gen/Program.cs

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

44
using Logicality.GitHub.Actions.Workflow;
55
using static GitHubContexts;
@@ -16,7 +16,7 @@
1616
["AccessTokenManagement.Tests"],
1717
"atm"),
1818

19-
new("identity-model",
19+
new("identity-model",
2020
["IdentityModel"],
2121
["IdentityModel.Tests"],
2222
"im"),
@@ -39,9 +39,9 @@
3939
void GenerateCiWorkflow(Component component)
4040
{
4141
var workflow = new Workflow(component.CiWorkflowName);
42-
var paths = new[]
42+
var paths = new[]
4343
{
44-
$".github/workflows/{component.Name}-**",
44+
$".github/workflows/{component.Name}-**",
4545
$"{component.Name}/**",
4646
"Directory.Packages.props"
4747
};
@@ -67,7 +67,7 @@ void GenerateCiWorkflow(Component component)
6767
job.Permissions(
6868
actions: Permission.Read,
6969
contents: Permission.Read,
70-
checks: Permission.Write,
70+
checks: Permission.Write,
7171
packages: Permission.Write);
7272

7373
job.TimeoutMinutes(15);
@@ -177,7 +177,7 @@ git push --delete origin {component.TagPrefix}-{contexts.Event.Input.Version}
177177
.RunsOn(GitHubHostedRunners.UbuntuLatest)
178178
.Needs("tag")
179179
.Environment("nuget.org", "");
180-
;
180+
;
181181

182182
publishJob.Step()
183183
.Uses("actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16") // 4.1.8
@@ -208,7 +208,7 @@ void GenerateUploadTestResultsWorkflow()
208208
.Job("report")
209209
.Name("report")
210210
.RunsOn(GitHubHostedRunners.UbuntuLatest);
211-
211+
212212
job.Permissions(
213213
actions: Permission.Read,
214214
contents: Permission.Read,
@@ -252,14 +252,14 @@ public static void StepSetupDotNet(this Job job)
252252
.Name("Setup .NET")
253253
.ActionsSetupDotNet("3e891b0cb619bf60e2c25674b222b8940e2c1c25", ["6.0.x", "8.0.x", "9.0.x"]); // v4.1.0
254254

255-
public static Step IfRefMain(this Step step)
255+
public static Step IfRefMain(this Step step)
256256
=> step.If("github.ref == 'refs/heads/main'");
257257

258258
public static void StepTest(this Job job, string componentName, string testProject)
259259
{
260-
var path = $"test/{testProject}";
260+
var path = $"test/{testProject}";
261261
var logFileName = $"{testProject}.trx";
262-
var flags = $"--logger \"console;verbosity=normal\" " +
262+
var flags = $"--logger \"console;verbosity=normal\" " +
263263
$"--logger \"trx;LogFileName={logFileName}\" " +
264264
$"--collect:\"XPlat Code Coverage\"";
265265
job.Step()
@@ -312,12 +312,12 @@ public static void StepPack(this Job job, string project)
312312

313313
public static void StepSign(this Job job, bool always = false)
314314
{
315-
var flags = "--file-digest sha256 " +
316-
"--timestamp-rfc3161 http://timestamp.digicert.com " +
315+
var flags = "--file-digest sha256 " +
316+
"--timestamp-rfc3161 http://timestamp.digicert.com " +
317317
"--azure-key-vault-url https://duendecodesigninghsm.vault.azure.net/ " +
318-
"--azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 " +
319-
"--azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 " +
320-
"--azure-key-vault-client-secret ${{ secrets.SignClientSecret }} " +
318+
"--azure-key-vault-client-id 18e3de68-2556-4345-8076-a46fad79e474 " +
319+
"--azure-key-vault-tenant-id ed3089f0-5401-4758-90eb-066124e2d907 " +
320+
"--azure-key-vault-client-secret ${{ secrets.SignClientSecret }} " +
321321
"--azure-key-vault-certificate NuGetPackageSigning";
322322
var step = job.Step()
323323
.Name("Sign packages");
@@ -377,10 +377,10 @@ public static void StepUploadArtifacts(this Job job, string componentName, bool
377377

378378
public class GitHubContexts
379379
{
380-
public static GitHubContexts Instance { get; } = new();
381-
public virtual GitHubContext GitHub { get; } = new();
382-
public virtual SecretsContext Secrets { get; } = new();
383-
public virtual EventContext Event { get; } = new();
380+
public static GitHubContexts Instance { get; } = new();
381+
public virtual GitHubContext GitHub { get; } = new();
382+
public virtual SecretsContext Secrets { get; } = new();
383+
public virtual EventContext Event { get; } = new();
384384

385385
public abstract class Context(string name)
386386
{
@@ -400,7 +400,7 @@ public class SecretsContext() : Context("secrets")
400400

401401
public class EventContext() : Context("github.event")
402402
{
403-
public EventsInputContext Input { get; } = new ();
403+
public EventsInputContext Input { get; } = new();
404404
}
405405

406406
public class EventsInputContext() : Context("github.event.inputs")

access-token-management/samples/BlazorServer/Data/WeatherForecast.cs

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

44
namespace BlazorServer.Services;
55

@@ -12,4 +12,4 @@ public class WeatherForecast
1212
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
1313

1414
public string? Summary { get; set; }
15-
}
15+
}

access-token-management/samples/BlazorServer/HostingExtensions.cs

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

44
using BlazorServer.Plumbing;
55
using BlazorServer.Services;
@@ -54,7 +54,7 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde
5454
// adds access token management
5555
builder.Services.AddOpenIdConnectAccessTokenManagement()
5656
.AddBlazorServerAccessTokenManagement<ServerSideTokenStore>();
57-
57+
5858
// register events to customize authentication handlers
5959
builder.Services.AddTransient<CookieEvents>();
6060
builder.Services.AddTransient<OidcEvents>();
@@ -72,14 +72,14 @@ public static WebApplication ConfigureServices(this WebApplicationBuilder builde
7272
.AddInteractiveServerComponents();
7373

7474
builder.Services.AddSingleton<WeatherForecastService>();
75-
75+
7676
return builder.Build();
7777
}
7878

7979
public static WebApplication ConfigurePipeline(this WebApplication app)
8080
{
8181
app.UseSerilogRequestLogging();
82-
82+
8383
app.UseStaticFiles();
8484

8585
app.UseRouting();
@@ -91,7 +91,7 @@ public static WebApplication ConfigurePipeline(this WebApplication app)
9191
app.MapDefaultControllerRoute();
9292
app.MapRazorComponents<App>()
9393
.AddInteractiveServerRenderMode();
94-
94+
9595
return app;
9696
}
97-
}
97+
}

access-token-management/samples/BlazorServer/Pages/Error.cshtml.cs

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

44
using System.Diagnostics;
55
using Microsoft.AspNetCore.Mvc;
@@ -26,4 +26,4 @@ public void OnGet()
2626
{
2727
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
2828
}
29-
}
29+
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) Duende Software. All rights reserved.
2-
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
2+
// See LICENSE in the project root for license information.
33

44
using Microsoft.AspNetCore.Authentication;
55
using Microsoft.AspNetCore.Authorization;
@@ -12,7 +12,7 @@ public class AccountController : ControllerBase
1212
{
1313
public IActionResult LogIn(string? returnUrl)
1414
{
15-
string redirectUri = "/";
15+
var redirectUri = "/";
1616

1717
if (!string.IsNullOrWhiteSpace(returnUrl))
1818
{
@@ -21,17 +21,17 @@ public IActionResult LogIn(string? returnUrl)
2121
redirectUri = returnUrl;
2222
}
2323
}
24-
24+
2525
var props = new AuthenticationProperties
2626
{
2727
RedirectUri = redirectUri
2828
};
29-
29+
3030
return Challenge(props);
3131
}
32-
32+
3333
public IActionResult LogOut()
3434
{
3535
return SignOut("cookie", "oidc");
3636
}
37-
}
37+
}

access-token-management/samples/BlazorServer/Plumbing/CookieEvents.cs

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

44
using Duende.AccessTokenManagement.OpenIdConnect;
55
using Microsoft.AspNetCore.Authentication;
@@ -15,7 +15,7 @@ public CookieEvents(IUserTokenStore store)
1515
{
1616
_store = store;
1717
}
18-
18+
1919
public override async Task ValidatePrincipal(CookieValidatePrincipalContext context)
2020
{
2121
var token = await _store.GetTokenAsync(context.Principal!);
@@ -30,7 +30,7 @@ public override async Task ValidatePrincipal(CookieValidatePrincipalContext cont
3030
public override async Task SigningOut(CookieSigningOutContext context)
3131
{
3232
await context.HttpContext.RevokeRefreshTokenAsync();
33-
33+
3434
await base.SigningOut(context);
3535
}
36-
}
36+
}

access-token-management/samples/BlazorServer/Plumbing/OidcEvents.cs

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

44
using Duende.AccessTokenManagement.OpenIdConnect;
55
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
@@ -14,10 +14,10 @@ public OidcEvents(IUserTokenStore store)
1414
{
1515
_store = store;
1616
}
17-
17+
1818
public override async Task TokenValidated(TokenValidatedContext context)
1919
{
20-
var exp = DateTimeOffset.UtcNow.AddSeconds(Double.Parse(context.TokenEndpointResponse!.ExpiresIn));
20+
var exp = DateTimeOffset.UtcNow.AddSeconds(double.Parse(context.TokenEndpointResponse!.ExpiresIn));
2121

2222
await _store.StoreTokenAsync(context.Principal!, new UserToken
2323
{
@@ -27,7 +27,7 @@ public override async Task TokenValidated(TokenValidatedContext context)
2727
RefreshToken = context.TokenEndpointResponse.RefreshToken,
2828
Scope = context.TokenEndpointResponse.Scope
2929
});
30-
30+
3131
await base.TokenValidated(context);
3232
}
33-
}
33+
}

access-token-management/samples/BlazorServer/Plumbing/ServerSideTokenStore.cs

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

44
using System.Collections.Concurrent;
55
using System.Security.Claims;
@@ -26,20 +26,20 @@ public Task<UserToken> GetTokenAsync(ClaimsPrincipal user, UserTokenRequestParam
2626

2727
return Task.FromResult(new UserToken { Error = "not found" });
2828
}
29-
29+
3030
public Task StoreTokenAsync(ClaimsPrincipal user, UserToken token, UserTokenRequestParameters? parameters = null)
3131
{
3232
var sub = user.FindFirst("sub")?.Value ?? throw new InvalidOperationException("no sub claim");
3333
_tokens[sub] = token;
34-
34+
3535
return Task.CompletedTask;
3636
}
37-
37+
3838
public Task ClearTokenAsync(ClaimsPrincipal user, UserTokenRequestParameters? parameters = null)
3939
{
4040
var sub = user.FindFirst("sub")?.Value ?? throw new InvalidOperationException("no sub claim");
41-
41+
4242
_tokens.TryRemove(sub, out _);
4343
return Task.CompletedTask;
4444
}
45-
}
45+
}

access-token-management/samples/BlazorServer/Program.cs

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

44
using BlazorServer;
55
using Serilog;
@@ -28,7 +28,7 @@
2828
var app = builder
2929
.ConfigureServices()
3030
.ConfigurePipeline();
31-
31+
3232
app.Run();
3333
}
3434
catch (Exception ex)
@@ -39,4 +39,4 @@
3939
{
4040
Log.Information("Shut down complete");
4141
Log.CloseAndFlush();
42-
}
42+
}

access-token-management/samples/BlazorServer/Services/RemoteApiService.cs

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

44
using System.Text.Json;
55

@@ -23,4 +23,4 @@ public async Task<string> GetData()
2323
var json = JsonSerializer.Deserialize<IEnumerable<Claim>>(response);
2424
return JsonSerializer.Serialize(json, new JsonSerializerOptions { WriteIndented = true });
2525
}
26-
}
26+
}

0 commit comments

Comments
 (0)