diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 550d2a57..67f37f76 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,5 +1,5 @@ # BUILD -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:11.0 AS build WORKDIR /src ENV CI=true @@ -7,15 +7,15 @@ ENV CI=true COPY docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/*.csproj CodeBeam.Website/ COPY docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/*.csproj CodeBeam.Website.Client/ -RUN dotnet restore CodeBeam.Website/CodeBeam.UltimateAuth.Docs.Wasm.csproj -p:UltimateAuthBuildTargetFrameworks=net10.0 +RUN dotnet restore CodeBeam.Website/CodeBeam.UltimateAuth.Docs.Wasm.csproj -p:UltimateAuthBuildTargetFrameworks=net11.0 COPY . . RUN dotnet publish docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.csproj \ - -c Release -p:UltimateAuthBuildTargetFrameworks=net10.0 -o /app/publish + -c Release -p:UltimateAuthBuildTargetFrameworks=net11.0 -o /app/publish # RUNTIME -FROM mcr.microsoft.com/dotnet/aspnet:10.0 +FROM mcr.microsoft.com/dotnet/aspnet:11.0 WORKDIR /app COPY --from=build /app/publish . diff --git a/.docker/Dockerfile.identitylab b/.docker/Dockerfile.identitylab index b786705d..0cefe67b 100644 --- a/.docker/Dockerfile.identitylab +++ b/.docker/Dockerfile.identitylab @@ -1,22 +1,22 @@ # Build -FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:11.0 AS build WORKDIR /src COPY . . RUN dotnet restore \ apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/CodeBeam.UltimateAuth.IdentityLab.csproj \ - -p:UltimateAuthBuildTargetFrameworks=net10.0 + -p:UltimateAuthBuildTargetFrameworks=net11.0 RUN dotnet publish \ apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/CodeBeam.UltimateAuth.IdentityLab.csproj \ -c Release \ - -p:UltimateAuthBuildTargetFrameworks=net10.0 \ + -p:UltimateAuthBuildTargetFrameworks=net11.0 \ --no-restore \ -o /app/publish # Runtime -FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime +FROM mcr.microsoft.com/dotnet/aspnet:11.0 AS runtime WORKDIR /app ENV ASPNETCORE_HTTP_PORTS=8080 diff --git a/.github/workflows/ultimateauth-ci.yml b/.github/workflows/ultimateauth-ci.yml index 5ef441b7..f4f89cd1 100644 --- a/.github/workflows/ultimateauth-ci.yml +++ b/.github/workflows/ultimateauth-ci.yml @@ -259,17 +259,10 @@ jobs: output.write("|---|---:|\n") output.write(f"| Lines | {line_rate:.2%} |\n") output.write(f"| Branches | {branch_rate:.2%} |\n") - output.write( - f"| Covered lines | {lines_covered:,} / {lines_valid:,} |\n" - ) - output.write( - f"| Covered branches | {branches_covered:,} / {branches_valid:,} |\n" - ) + output.write(f"| Covered lines | {lines_covered:,} / {lines_valid:,} |\n") + output.write(f"| Covered branches | {branches_covered:,} / {branches_valid:,} |\n") output.write("\n") - output.write( - "Coverage is reported separately from UltimateAuth " - "framework coverage.\n" - ) + output.write("Coverage is reported separately from UltimateAuth framework coverage.\n") PY - name: Upload Identity Lab test and coverage results diff --git a/Directory.Build.props b/Directory.Build.props index 24d8c3ce..15372295 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net8.0;net9.0;net10.0 + net8.0;net9.0;net10.0;net11.0 $([System.Text.RegularExpressions.Regex]::Match('$(UltimateAuthTargetFrameworks)', '[^;]+$').Value) $(UltimateAuthTargetFrameworks) diff --git a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/CodeBeam.UltimateAuth.IdentityLab.csproj b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/CodeBeam.UltimateAuth.IdentityLab.csproj index de41bbeb..445b5fe0 100644 --- a/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/CodeBeam.UltimateAuth.IdentityLab.csproj +++ b/apps/identity-lab/CodeBeam.UltimateAuth.IdentityLab/CodeBeam.UltimateAuth.IdentityLab.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable true @@ -10,14 +10,14 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/CodeBeam.UltimateAuth.Docs.Wasm.Client.csproj b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/CodeBeam.UltimateAuth.Docs.Wasm.Client.csproj index a4e8ea48..809193fc 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/CodeBeam.UltimateAuth.Docs.Wasm.Client.csproj +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/CodeBeam.UltimateAuth.Docs.Wasm.Client.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable true @@ -11,10 +11,10 @@ - - - - + + + + diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/Pages/DocsToc.razor b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/Pages/DocsToc.razor index 93cdf54d..c01530e9 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/Pages/DocsToc.razor +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.Client/Pages/DocsToc.razor @@ -34,7 +34,15 @@ if (_ref == null && PageState.Headings.Count > 0) { _ref = DotNetObjectReference.Create(this); - await JS.InvokeVoidAsync("uaDocsScrollSpy.start", _ref); + try + { + await JS.InvokeVoidAsync("uaDocsScrollSpy.start", _ref); + } + catch (Exception) + { + throw; + } + } } @@ -58,14 +66,33 @@ private async Task OnClick(string id) { PageState.SetActiveHeading(id); - await JS.InvokeVoidAsync("uaDocsScrollSpy.scrollTo", id); + + try + { + await JS.InvokeVoidAsync("uaDocsScrollSpy.scrollTo", id); + } + catch (Exception) + { + throw; + } } private string GetClass(DocsHeadingItem item) => item.Id == PageState.ActiveHeadingId ? "active toc-active" : ""; private Task ScrollTo(string id) - => JS.InvokeVoidAsync("uaDocsScrollSpy.scrollTo", id).AsTask(); + { + try + { + JS.InvokeVoidAsync("uaDocsScrollSpy.scrollTo", id).AsTask(); + } + catch (Exception) + { + throw; + } + + return Task.CompletedTask; + } public void Dispose() { diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.csproj b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.csproj index d84cbca3..e641e0cc 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.csproj +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm.csproj @@ -1,7 +1,7 @@ - net10.0 + net11.0 enable enable true @@ -10,7 +10,7 @@ - + diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Program.cs b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Program.cs index 82a4cab5..86440f5c 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Program.cs +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Program.cs @@ -33,7 +33,7 @@ if (app.Environment.IsDevelopment()) { - app.UseWebAssemblyDebugging(); + } else { diff --git a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Properties/launchSettings.json b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Properties/launchSettings.json index 3e4e3764..8c97f01e 100644 --- a/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Properties/launchSettings.json +++ b/docs/website/CodeBeam.UltimateAuth.Docs.Wasm/CodeBeam.UltimateAuth.Docs.Wasm/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "http://localhost:5086", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -15,7 +14,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "https://localhost:7287;http://localhost:5086", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/samples/CodeBeam.UltimateAuth.Sample.Shared.Hub/CodeBeam.UltimateAuth.Sample.Shared.Hub.csproj b/samples/CodeBeam.UltimateAuth.Sample.Shared.Hub/CodeBeam.UltimateAuth.Sample.Shared.Hub.csproj index f584ea61..802d4aef 100644 --- a/samples/CodeBeam.UltimateAuth.Sample.Shared.Hub/CodeBeam.UltimateAuth.Sample.Shared.Hub.csproj +++ b/samples/CodeBeam.UltimateAuth.Sample.Shared.Hub/CodeBeam.UltimateAuth.Sample.Shared.Hub.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable false diff --git a/samples/CodeBeam.UltimateAuth.Sample.Shared/CodeBeam.UltimateAuth.Sample.Shared.csproj b/samples/CodeBeam.UltimateAuth.Sample.Shared/CodeBeam.UltimateAuth.Sample.Shared.csproj index 2c994fb2..be89ceca 100644 --- a/samples/CodeBeam.UltimateAuth.Sample.Shared/CodeBeam.UltimateAuth.Sample.Shared.csproj +++ b/samples/CodeBeam.UltimateAuth.Sample.Shared/CodeBeam.UltimateAuth.Sample.Shared.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable false @@ -12,11 +12,10 @@ - - - - - + + + + diff --git a/samples/CodeBeam.UltimateAuth.Sample.Shared/Components/Page/SampleLandingPage.razor.cs b/samples/CodeBeam.UltimateAuth.Sample.Shared/Components/Page/SampleLandingPage.razor.cs index 7c20f85c..04588813 100644 --- a/samples/CodeBeam.UltimateAuth.Sample.Shared/Components/Page/SampleLandingPage.razor.cs +++ b/samples/CodeBeam.UltimateAuth.Sample.Shared/Components/Page/SampleLandingPage.razor.cs @@ -1,16 +1,21 @@ using CodeBeam.UltimateAuth.Core.Defaults; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Authorization; namespace CodeBeam.UltimateAuth.Sample.Shared.Components.Page; public partial class SampleLandingPage { + [CascadingParameter] + private Task AuthenticationStateTask { get; set; } = default!; + protected override async Task OnAfterRenderAsync(bool firstRender) { if (!firstRender) return; - var state = await AuthProvider.GetAuthenticationStateAsync(); - var isAuthenticated = state.User.Identity?.IsAuthenticated == true; + var authState = await AuthenticationStateTask; + var isAuthenticated = authState.User.Identity?.IsAuthenticated == true; Nav.NavigateTo(isAuthenticated ? "/home" : $"{UAuthConstants.Routes.LoginRedirect}?fresh=true"); } diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.csproj b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.csproj index c82d7e9a..01d8f879 100644 --- a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.csproj +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore/CodeBeam.UltimateAuth.Sample.UAuthHub.EFCore.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable false @@ -9,17 +9,17 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.csproj b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.csproj index 6106524c..f39d5401 100644 --- a/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.csproj +++ b/samples/UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub/CodeBeam.UltimateAuth.Sample.UAuthHub.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable false @@ -9,8 +9,8 @@ - - + + diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.csproj b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.csproj index e15aaf63..ea241147 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.csproj +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore/CodeBeam.UltimateAuth.Sample.BlazorServer.EFCore.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable false @@ -9,17 +9,17 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/CodeBeam.UltimateAuth.Sample.BlazorServer.csproj b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/CodeBeam.UltimateAuth.Sample.BlazorServer.csproj index a582eeab..fbdffc3d 100644 --- a/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/CodeBeam.UltimateAuth.Sample.BlazorServer.csproj +++ b/samples/blazor-server/CodeBeam.UltimateAuth.Sample.BlazorServer/CodeBeam.UltimateAuth.Sample.BlazorServer.csproj @@ -1,15 +1,15 @@  - net10.0 + net11.0 enable enable false - - + + diff --git a/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm.csproj b/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm.csproj index 2a2789ad..e2ffe5c3 100644 --- a/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm.csproj +++ b/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm.csproj @@ -1,17 +1,17 @@  - net10.0 + net11.0 enable enable false - - - - + + + + diff --git a/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/Properties/launchSettings.json b/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/Properties/launchSettings.json index 0e706d48..c879e241 100644 --- a/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/Properties/launchSettings.json +++ b/samples/blazor-standalone-wasm/CodeBeam.UltimateAuth.Sample.BlazorStandaloneWasm/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "http://localhost:6131", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -15,7 +14,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "https://localhost:6130;http://localhost:6131", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.Client/CodeBeam.UAuth.Sample.IntWasm.Client.csproj b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.Client/CodeBeam.UAuth.Sample.IntWasm.Client.csproj index 7e8c8c20..e0bc841f 100644 --- a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.Client/CodeBeam.UAuth.Sample.IntWasm.Client.csproj +++ b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.Client/CodeBeam.UAuth.Sample.IntWasm.Client.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable true @@ -11,8 +11,8 @@ - - + + diff --git a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.csproj b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.csproj index 566055dd..8e8a5569 100644 --- a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.csproj +++ b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 enable enable false @@ -11,7 +11,7 @@ - + diff --git a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Program.cs b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Program.cs index bff64bcf..a54b8d65 100644 --- a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Program.cs +++ b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Program.cs @@ -46,7 +46,7 @@ if (app.Environment.IsDevelopment()) { - app.UseWebAssemblyDebugging(); + } else { diff --git a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Properties/launchSettings.json b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Properties/launchSettings.json index 40513f8d..57c6c61b 100644 --- a/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Properties/launchSettings.json +++ b/samples/int-wasm/CodeBeam.UAuth.Sample.IntWasm/CodeBeam.UAuth.Sample.IntWasm/Properties/launchSettings.json @@ -5,7 +5,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "http://localhost:6133", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -15,7 +14,6 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", "applicationUrl": "https://localhost:6132;http://localhost:6133", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore.csproj b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore.csproj index 3d660c31..81ddb19e 100644 --- a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore.csproj +++ b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore/CodeBeam.UltimateAuth.Sample.ResourceApi.EfCore.csproj @@ -1,14 +1,14 @@  - net10.0 + net11.0 enable enable false - + diff --git a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/CodeBeam.UltimateAuth.Sample.ResourceApi.csproj b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/CodeBeam.UltimateAuth.Sample.ResourceApi.csproj index 3d660c31..81ddb19e 100644 --- a/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/CodeBeam.UltimateAuth.Sample.ResourceApi.csproj +++ b/samples/resource-api/CodeBeam.UltimateAuth.Sample.ResourceApi/CodeBeam.UltimateAuth.Sample.ResourceApi.csproj @@ -1,14 +1,14 @@  - net10.0 + net11.0 enable enable false - + diff --git a/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj b/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj index f34b9a2a..3214552c 100644 --- a/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj +++ b/src/CodeBeam.UltimateAuth.Core/CodeBeam.UltimateAuth.Core.csproj @@ -12,10 +12,28 @@ README.md - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/client/CodeBeam.UltimateAuth.Client.Blazor/CodeBeam.UltimateAuth.Client.Blazor.csproj b/src/client/CodeBeam.UltimateAuth.Client.Blazor/CodeBeam.UltimateAuth.Client.Blazor.csproj index b1025b46..20f1c80f 100644 --- a/src/client/CodeBeam.UltimateAuth.Client.Blazor/CodeBeam.UltimateAuth.Client.Blazor.csproj +++ b/src/client/CodeBeam.UltimateAuth.Client.Blazor/CodeBeam.UltimateAuth.Client.Blazor.csproj @@ -33,6 +33,12 @@ + + + + + + diff --git a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Components/UAuthLoginForm.razor.cs b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Components/UAuthLoginForm.razor.cs index a046c0a3..0dd5a45a 100644 --- a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Components/UAuthLoginForm.razor.cs +++ b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Components/UAuthLoginForm.razor.cs @@ -349,6 +349,10 @@ await UAuthLoginCompletion.CompleteAsync( if (OnTryResult.HasDelegate) await OnTryResult.InvokeAsync(parsed); } + catch (JSDisconnectedException) + { + // The circuit was disconnected before the login operation completed. + } finally { _isSubmitting = false; diff --git a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/BrowserClientStorage.cs b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/BrowserClientStorage.cs index 46436d41..0ea7ac51 100644 --- a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/BrowserClientStorage.cs +++ b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/BrowserClientStorage.cs @@ -54,8 +54,8 @@ public ValueTask RemoveAsync(StorageScope scope, string key) /// /// /// - public async ValueTask ExistsAsync(StorageScope scope, string key) - => await _js.InvokeAsync("uauth.storage.exists", Scope(scope), key); + public ValueTask ExistsAsync(StorageScope scope, string key) + => _js.InvokeAsync("uauth.storage.exists", Scope(scope), key); /// /// Gets the string representation of the storage scope for use in JavaScript interop. diff --git a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/UAuthRequestClient.cs b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/UAuthRequestClient.cs index cf1e9cf7..730b2b15 100644 --- a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/UAuthRequestClient.cs +++ b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/UAuthRequestClient.cs @@ -37,9 +37,9 @@ public async Task NavigateAsync(string endpoint, IDictionary? fo { ct.ThrowIfCancellationRequested(); - await _bootstrapper.EnsureStartedAsync(); + await _bootstrapper.EnsureStartedAsync(ct); - await _js.InvokeVoidAsync("uauth.post", ct, new + await InvokeVoidAsync("uauth.post", ct, new { url = endpoint, mode = "navigate", @@ -56,9 +56,9 @@ public async Task SendFormAsync(string endpoint, IDictiona { ct.ThrowIfCancellationRequested(); - await _bootstrapper.EnsureStartedAsync(); + await _bootstrapper.EnsureStartedAsync(ct); - var result = await _js.InvokeAsync( + var result = await InvokeAsync( "uauth.post", ct, new @@ -84,9 +84,9 @@ public async Task SendFormAsync(string endpoint, IDictiona { ct.ThrowIfCancellationRequested(); - await _bootstrapper.EnsureStartedAsync(); + await _bootstrapper.EnsureStartedAsync(ct); - var result = await _js.InvokeAsync("uauth.post", ct, + var result = await InvokeAsync("uauth.post", ct, new { url = endpoint, @@ -109,9 +109,9 @@ public async Task SendJsonAsync(string endpoint, object? p { ct.ThrowIfCancellationRequested(); - await _bootstrapper.EnsureStartedAsync(); + await _bootstrapper.EnsureStartedAsync(ct); - var result = await _js.InvokeAsync( + var result = await InvokeAsync( "uauth.postJson", ct, new @@ -136,9 +136,9 @@ public async Task TryAndCommitAsync(string tryEndpoint, { ct.ThrowIfCancellationRequested(); - await _bootstrapper.EnsureStartedAsync(); + await _bootstrapper.EnsureStartedAsync(ct); - var response = await _js.InvokeAsync( + var response = await InvokeAsync( "uauth.tryAndCommit", ct, new @@ -169,7 +169,7 @@ public async Task GetLoginTransportAsync(string endpoin await _bootstrapper.EnsureStartedAsync(ct); - var response = await _js.InvokeAsync( + var response = await InvokeAsync( "uauth.getLoginTransport", ct, new @@ -219,14 +219,8 @@ public Task NavigateToPkceReturnUrlAsync(string redirectUrl, string expectedRetu { ct.ThrowIfCancellationRequested(); - if (!Uri.TryCreate( - expectedReturnUrl, - UriKind.Absolute, - out var expected) || - !Uri.TryCreate( - redirectUrl, - UriKind.Absolute, - out var target) || + if (!Uri.TryCreate(expectedReturnUrl, UriKind.Absolute, out var expected) || + !Uri.TryCreate(redirectUrl, UriKind.Absolute, out var target) || target != expected || target.Scheme is not ("https" or "http") || !string.IsNullOrEmpty(target.UserInfo)) @@ -236,10 +230,7 @@ target.Scheme is not ("https" or "http") || var current = new Uri(_navigation.Uri); - var crossOrigin = - target.Scheme != current.Scheme || - target.Authority != current.Authority; - + var crossOrigin = target.Scheme != current.Scheme || target.Authority != current.Authority; _navigation.NavigateTo(target.ToString(), forceLoad: crossOrigin); return Task.CompletedTask; @@ -274,4 +265,36 @@ target.Scheme is not ("https" or "http") || return null; } + + private async ValueTask InvokeVoidAsync(string identifier, CancellationToken ct, params object?[] args) + { + try + { + await _js.InvokeVoidAsync(identifier, ct, args); + } + catch (JSDisconnectedException ex) + { + throw new UAuthTransportException("The JavaScript runtime was disconnected.", ex); + } + catch (JSException ex) + { + throw new UAuthTransportException("The JavaScript transport operation failed.", ex); + } + } + + private async ValueTask InvokeAsync(string identifier, CancellationToken ct, params object?[] args) + { + try + { + return await _js.InvokeAsync(identifier, ct, args); + } + catch (JSDisconnectedException ex) + { + throw new UAuthTransportException("The JavaScript runtime was disconnected.", ex); + } + catch (JSException ex) + { + throw new UAuthTransportException("The JavaScript transport operation failed.", ex); + } + } } diff --git a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/WebClientDeviceProvider.cs b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/WebClientDeviceProvider.cs index df819951..3cc98210 100644 --- a/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/WebClientDeviceProvider.cs +++ b/src/client/CodeBeam.UltimateAuth.Client.Blazor/Infrastructure/WebClientDeviceProvider.cs @@ -1,4 +1,5 @@ using CodeBeam.UltimateAuth.Client.Abstractions; +using CodeBeam.UltimateAuth.Client.Errors; using CodeBeam.UltimateAuth.Core.Abstractions; using CodeBeam.UltimateAuth.Core.Domain; using Microsoft.JSInterop; @@ -21,7 +22,22 @@ public WebClientDeviceProvider(IJSRuntime js, IDeviceIdProvider deviceIdProvider public async Task GetAsync() { var deviceId = await _deviceIdProvider.GetOrCreateAsync(); - var jsInfo = await _js.InvokeAsync("uauth.getDeviceInfo"); + + ClientDeviceJsInfo jsInfo; + + try + { + jsInfo = await _js.InvokeAsync("uauth.getDeviceInfo"); + } + catch (JSDisconnectedException ex) + { + throw new UAuthTransportException("The JavaScript runtime was disconnected.", ex); + } + catch (JSException ex) + { + throw new UAuthTransportException("Unable to retrieve browser device information.", ex); + } + var ua = jsInfo.UserAgent; var parsed = _userAgentParser.Parse(ua); diff --git a/src/client/CodeBeam.UltimateAuth.Client.JsMinifier/CodeBeam.UltimateAuth.Client.JsMinifier.csproj b/src/client/CodeBeam.UltimateAuth.Client.JsMinifier/CodeBeam.UltimateAuth.Client.JsMinifier.csproj index bc6e3e8f..aa959f7e 100644 --- a/src/client/CodeBeam.UltimateAuth.Client.JsMinifier/CodeBeam.UltimateAuth.Client.JsMinifier.csproj +++ b/src/client/CodeBeam.UltimateAuth.Client.JsMinifier/CodeBeam.UltimateAuth.Client.JsMinifier.csproj @@ -1,13 +1,13 @@  - net10.0 + net11.0 Exe false - + diff --git a/src/persistence/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCore.csproj b/src/persistence/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCore.csproj index cf84ac1b..30da1845 100644 --- a/src/persistence/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCore.csproj +++ b/src/persistence/CodeBeam.UltimateAuth.EntityFrameworkCore/CodeBeam.UltimateAuth.EntityFrameworkCore.csproj @@ -29,6 +29,10 @@ + + + + diff --git a/src/utilities/CodeBeam.UltimateAuth.DocsBuilder/CodeBeam.UltimateAuth.DocsBuilder.csproj b/src/utilities/CodeBeam.UltimateAuth.DocsBuilder/CodeBeam.UltimateAuth.DocsBuilder.csproj index bcef26b9..dca46d13 100644 --- a/src/utilities/CodeBeam.UltimateAuth.DocsBuilder/CodeBeam.UltimateAuth.DocsBuilder.csproj +++ b/src/utilities/CodeBeam.UltimateAuth.DocsBuilder/CodeBeam.UltimateAuth.DocsBuilder.csproj @@ -2,7 +2,7 @@ Exe - net10.0 + net11.0 enable enable false diff --git a/tests/CodeBeam.UltimateAuth.IdentityLab.Tests/CodeBeam.UltimateAuth.IdentityLab.Tests.csproj b/tests/CodeBeam.UltimateAuth.IdentityLab.Tests/CodeBeam.UltimateAuth.IdentityLab.Tests.csproj index 7f863920..b7d739ba 100644 --- a/tests/CodeBeam.UltimateAuth.IdentityLab.Tests/CodeBeam.UltimateAuth.IdentityLab.Tests.csproj +++ b/tests/CodeBeam.UltimateAuth.IdentityLab.Tests/CodeBeam.UltimateAuth.IdentityLab.Tests.csproj @@ -4,17 +4,21 @@ true - - - - + + + + - - + + + + + + diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/CodeBeam.UltimateAuth.Tests.Integration.EfCore.csproj b/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/CodeBeam.UltimateAuth.Tests.Integration.EfCore.csproj index b30b0606..e55a797f 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/CodeBeam.UltimateAuth.Tests.Integration.EfCore.csproj +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration.EfCore/CodeBeam.UltimateAuth.Tests.Integration.EfCore.csproj @@ -8,11 +8,11 @@ - - - - - + + + + + @@ -23,4 +23,9 @@ + + + + + \ No newline at end of file diff --git a/tests/CodeBeam.UltimateAuth.Tests.Integration/CodeBeam.UltimateAuth.Tests.Integration.csproj b/tests/CodeBeam.UltimateAuth.Tests.Integration/CodeBeam.UltimateAuth.Tests.Integration.csproj index b6a5b7a8..dc90c42c 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Integration/CodeBeam.UltimateAuth.Tests.Integration.csproj +++ b/tests/CodeBeam.UltimateAuth.Tests.Integration/CodeBeam.UltimateAuth.Tests.Integration.csproj @@ -8,11 +8,11 @@ - - - + + + - + @@ -23,4 +23,9 @@ + + + + + \ No newline at end of file diff --git a/tests/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility.csproj b/tests/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility.csproj index 104a4c4e..88fc5b7d 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility.csproj +++ b/tests/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility/CodeBeam.UltimateAuth.Tests.RateLimiting.Compatibility.csproj @@ -1,10 +1,10 @@ - + false - + @@ -19,4 +19,7 @@ + + + diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs index fb66e4a8..d39c2669 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/Client/Blazor/UAuthRequestClientTests.cs @@ -46,12 +46,15 @@ private UAuthRequestClient CreateSut(UAuthApplicationProfile profile = UAuthAppl public async Task NavigateAsync_InvokesUAuthPost() { var sut = CreateSut(); - await sut.NavigateAsync("/login", ct: Xunit.TestContext.Current.CancellationToken); + var ct = Xunit.TestContext.Current.CancellationToken; + + await sut.NavigateAsync("/login", ct: ct); var invocation = JSInterop.Invocations.Single(x => x.Identifier == "uauth.post"); + invocation.Arguments.Should().ContainSingle(); - _bootstrapper.Verify(x => x.EnsureStartedAsync(), Times.Once); + _bootstrapper.Verify(x => x.EnsureStartedAsync(ct), Times.Once); } [Fact] diff --git a/tests/CodeBeam.UltimateAuth.Tests.Unit/CodeBeam.UltimateAuth.Tests.Unit.csproj b/tests/CodeBeam.UltimateAuth.Tests.Unit/CodeBeam.UltimateAuth.Tests.Unit.csproj index bf71f5b0..17843167 100644 --- a/tests/CodeBeam.UltimateAuth.Tests.Unit/CodeBeam.UltimateAuth.Tests.Unit.csproj +++ b/tests/CodeBeam.UltimateAuth.Tests.Unit/CodeBeam.UltimateAuth.Tests.Unit.csproj @@ -7,12 +7,12 @@ - + - + - - + + @@ -55,4 +55,9 @@ + + + + + \ No newline at end of file diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index b17f63d7..bf79cd1d 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -7,7 +7,7 @@ true - - + +