From 95d4067e80cb2bf29bc565bbf33272dbfcada404 Mon Sep 17 00:00:00 2001 From: Anders Revsgaard Date: Mon, 13 Nov 2023 10:35:09 +0100 Subject: [PATCH 1/5] .NET 7 added --- .../BlazorWAOidcSample.Client.csproj | 10 ++--- .../BlazorWAOidcSample.Server.csproj | 6 +-- .../BlazorWAOidcSample.Shared.csproj | 2 +- .../Extensions/ServiceCollectionExtensions.cs | 2 +- .../ITfoxtec.Identity.BlazorWA.Oidc.csproj | 42 ++++++++++++++----- .../OpenidConnectPkce.cs | 8 ++-- 6 files changed, 46 insertions(+), 24 deletions(-) diff --git a/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj b/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj index 548d429..661d61c 100644 --- a/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj +++ b/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj @@ -1,16 +1,16 @@  - net6.0 + net7.0 BlazorWebAssemblyOidcSample.Client BlazorWebAssemblyOidcSample.Client - - - - + + + + diff --git a/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj b/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj index 987f0c4..d194b83 100644 --- a/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj +++ b/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj @@ -1,14 +1,14 @@ - net6.0 + net7.0 BlazorWebAssemblyOidcSample.Server BlazorWebAssemblyOidcSample.Server - - + + diff --git a/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj b/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj index 24398a1..eac392f 100644 --- a/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj +++ b/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 BlazorWebAssemblyOidcSample.Shared BlazorWebAssemblyOidcSample.Shared diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs b/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs index b81c097..68eda97 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs @@ -29,7 +29,7 @@ public static IServiceCollection AddOpenidConnectPkce(this IServiceCollection se #endif services.AddScoped(); -#if NETSTANDARD +#if !NET50 && !NET60 && !NET70 services.AddTransient(); #else services.AddScoped(); diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj index 84623ac..07d7951 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj @@ -1,7 +1,7 @@  - net6.0;net5.0;netstandard2.1 + net7.0;net6.0;net5.0;netstandard2.1 ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect @@ -9,6 +9,7 @@ ITfoxtec A JavaScript free OpenID Connect PKCE library for Blazor WebAssembly. + Support .NET 7.0 Support .NET 6.0 Support .NET 5.0 Support .NET Standard 2.0 @@ -22,19 +23,36 @@ The component automatically handle token / session update with use of the refres Blazor WebAssembly OpenID Connect (OIDC) Proof Key for Code Exchange (PKCE) id token access token refresh token true © 2020 ITfoxtec - 1.6.3.0 - 1.6.3.0 - 1.6.3 + 1.6.4.0 + 1.6.4.0 + 1.6.4 - - - + + + + + - + + NET70;NET + + + pdbonly + true + true + $(NoWarn);1591;1573 + + + true + $(NoWarn);1591;1573 + + - - + + + + NET60;NET @@ -51,6 +69,8 @@ The component automatically handle token / session update with use of the refres + + @@ -69,6 +89,8 @@ The component automatically handle token / session update with use of the refres + + diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs b/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs index eed8bdd..8eee1c7 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs @@ -15,7 +15,7 @@ using System.Security; using System.Security.Claims; using System.Threading.Tasks; -#if !NET50 && !NET60 +#if !NET50 && !NET60 && !NET70 using ITfoxtec.Identity.Models; #endif @@ -169,7 +169,7 @@ public async Task LoginCallBackAsync(string responseUrl) // https://github.com/dotnet/runtime/issues/40074 // .NET 7 // https://github.com/dotnet/designs/blob/main/accepted/2021/blazor-wasm-crypto.md#net-7-plan -#if !NET50 && !NET60 +#if !NET50 && !NET60 && !NET70 var oidcDiscoveryKeySet = await GetOidcDiscoveryKeysAsync(openidClientPkceState.OidcDiscoveryUri); (var idTokenPrincipal, _) = JwtHandler.ValidateToken(tokenResponse.IdToken, oidcDiscovery.Issuer, oidcDiscoveryKeySet.Keys.ToMSJsonWebKeys(), openidClientPkceState.ClientId, @@ -242,7 +242,7 @@ public async Task HandleRefreshTokenAsync(OidcUserSession userS // https://github.com/dotnet/runtime/issues/40074 // .NET 7 // https://github.com/dotnet/designs/blob/main/accepted/2021/blazor-wasm-crypto.md#net-7-plan -#if !NET50 && !NET60 +#if !NET50 && !NET60 && !NET70 var oidcDiscoveryKeySet = await GetOidcDiscoveryKeysAsync(oidcDiscoveryUri); (var idTokenPrincipal, _) = JwtHandler.ValidateToken(tokenResponse.IdToken, oidcDiscovery.Issuer, oidcDiscoveryKeySet.Keys, clientId, @@ -368,7 +368,7 @@ private async Task GetOidcDiscoveryAsync(string oidcDiscoveryUri) } } -#if !NET50 && !NET60 +#if !NET50 && !NET60 && !NET70 private async Task GetOidcDiscoveryKeysAsync(string oidcDiscoveryUri) { try From 3c960f08882864e655422b24dad933c8d37663bb Mon Sep 17 00:00:00 2001 From: Anders Revsgaard Date: Tue, 14 Nov 2023 22:26:15 +0100 Subject: [PATCH 2/5] Support .NET 8.0 --- .../BlazorWAOidcSample.Client.csproj | 9 +++--- .../BlazorWAOidcSample.Server.csproj | 6 ++-- .../BlazorWAOidcSample.Shared.csproj | 2 +- .../Extensions/ServiceCollectionExtensions.cs | 2 +- .../ITfoxtec.Identity.BlazorWA.Oidc.csproj | 29 ++++++++++++++++--- .../OpenidConnectPkce.cs | 8 ++--- 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj b/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj index 661d61c..bca9c48 100644 --- a/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj +++ b/samples/BlazorWAOidcSample.Client/BlazorWAOidcSample.Client.csproj @@ -1,16 +1,15 @@  - net7.0 + net8.0 BlazorWebAssemblyOidcSample.Client BlazorWebAssemblyOidcSample.Client - - - - + + + diff --git a/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj b/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj index d194b83..8f2a2ac 100644 --- a/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj +++ b/samples/BlazorWAOidcSample.Server/BlazorWAOidcSample.Server.csproj @@ -1,14 +1,14 @@ - net7.0 + net8.0 BlazorWebAssemblyOidcSample.Server BlazorWebAssemblyOidcSample.Server - - + + diff --git a/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj b/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj index eac392f..a62a1fe 100644 --- a/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj +++ b/samples/BlazorWAOidcSample.Shared/BlazorWAOidcSample.Shared.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 BlazorWebAssemblyOidcSample.Shared BlazorWebAssemblyOidcSample.Shared diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs b/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs index 68eda97..4ece39f 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs @@ -29,7 +29,7 @@ public static IServiceCollection AddOpenidConnectPkce(this IServiceCollection se #endif services.AddScoped(); -#if !NET50 && !NET60 && !NET70 +#if NETSTANDARD services.AddTransient(); #else services.AddScoped(); diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj index 07d7951..7a76a0b 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj @@ -1,7 +1,7 @@  - net7.0;net6.0;net5.0;netstandard2.1 + net8.0;net7.0;net6.0;net5.0;netstandard2.1 ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect @@ -9,6 +9,7 @@ ITfoxtec A JavaScript free OpenID Connect PKCE library for Blazor WebAssembly. + Support .NET 8.0 Support .NET 7.0 Support .NET 6.0 Support .NET 5.0 @@ -23,11 +24,31 @@ The component automatically handle token / session update with use of the refres Blazor WebAssembly OpenID Connect (OIDC) Proof Key for Code Exchange (PKCE) id token access token refresh token true © 2020 ITfoxtec - 1.6.4.0 - 1.6.4.0 - 1.6.4 + 1.6.5.0 + 1.6.5.0 + 1.6.5 + + + + + + + + NET80;NET + + + pdbonly + true + true + $(NoWarn);1591;1573 + + + true + $(NoWarn);1591;1573 + + diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs b/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs index 8eee1c7..a924825 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs @@ -15,7 +15,7 @@ using System.Security; using System.Security.Claims; using System.Threading.Tasks; -#if !NET50 && !NET60 && !NET70 +#if NETSTANDARD using ITfoxtec.Identity.Models; #endif @@ -169,7 +169,7 @@ public async Task LoginCallBackAsync(string responseUrl) // https://github.com/dotnet/runtime/issues/40074 // .NET 7 // https://github.com/dotnet/designs/blob/main/accepted/2021/blazor-wasm-crypto.md#net-7-plan -#if !NET50 && !NET60 && !NET70 +#if NETSTANDARD var oidcDiscoveryKeySet = await GetOidcDiscoveryKeysAsync(openidClientPkceState.OidcDiscoveryUri); (var idTokenPrincipal, _) = JwtHandler.ValidateToken(tokenResponse.IdToken, oidcDiscovery.Issuer, oidcDiscoveryKeySet.Keys.ToMSJsonWebKeys(), openidClientPkceState.ClientId, @@ -242,7 +242,7 @@ public async Task HandleRefreshTokenAsync(OidcUserSession userS // https://github.com/dotnet/runtime/issues/40074 // .NET 7 // https://github.com/dotnet/designs/blob/main/accepted/2021/blazor-wasm-crypto.md#net-7-plan -#if !NET50 && !NET60 && !NET70 +#if NETSTANDARD var oidcDiscoveryKeySet = await GetOidcDiscoveryKeysAsync(oidcDiscoveryUri); (var idTokenPrincipal, _) = JwtHandler.ValidateToken(tokenResponse.IdToken, oidcDiscovery.Issuer, oidcDiscoveryKeySet.Keys, clientId, @@ -368,7 +368,7 @@ private async Task GetOidcDiscoveryAsync(string oidcDiscoveryUri) } } -#if !NET50 && !NET60 && !NET70 +#if NETSTANDARD private async Task GetOidcDiscoveryKeysAsync(string oidcDiscoveryUri) { try From 9ba6203e649b3e8916f57ad7ec4c2763a20b498d Mon Sep 17 00:00:00 2001 From: Anders Revsgaard Date: Wed, 15 Nov 2023 12:05:01 +0100 Subject: [PATCH 3/5] Validate tokens with user info endpoint. Remove netstandard2.1. --- .../Extensions/ServiceCollectionExtensions.cs | 10 +--- .../ITfoxtec.Identity.BlazorWA.Oidc.csproj | 31 ++-------- .../OpenidConnectPkce.cs | 59 +++---------------- 3 files changed, 14 insertions(+), 86 deletions(-) diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs b/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs index 4ece39f..b928e1e 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/Extensions/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ using Blazored.SessionStorage; using ITfoxtec.Identity.Discovery; +using ITfoxtec.Identity.Helpers; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Logging; @@ -22,18 +23,11 @@ public static IServiceCollection AddOpenidConnectPkce(this IServiceCollection se services.AddSingleton(openIDClientPkceSettings); services.AddScoped(); -#if NETSTANDARD - services.AddSingleton(sp => new OidcDiscoveryHandler(sp.GetService())); -#else services.AddSingleton(sp => new OidcDiscoveryHandler(sp.GetService())); -#endif + services.AddScoped(sp => new OidcHelper(sp.GetService(), sp.GetService())); services.AddScoped(); -#if NETSTANDARD - services.AddTransient(); -#else services.AddScoped(); -#endif services.AddOptions(); services.AddAuthorizationCore(); diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj index 7a76a0b..86d49ae 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj @@ -1,7 +1,7 @@  - net8.0;net7.0;net6.0;net5.0;netstandard2.1 + net8.0;net7.0;net6.0;net5.0 ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect @@ -29,8 +29,11 @@ The component automatically handle token / session update with use of the refres 1.6.5 + + + + - @@ -50,7 +53,6 @@ The component automatically handle token / session update with use of the refres - @@ -70,7 +72,6 @@ The component automatically handle token / session update with use of the refres - @@ -90,7 +91,6 @@ The component automatically handle token / session update with use of the refres - @@ -108,26 +108,5 @@ The component automatically handle token / session update with use of the refres true $(NoWarn);1591;1573 - - - - - - - - - - NETSTANDARD2;NETSTANDARD - - - pdbonly - true - true - $(NoWarn);1591;1573 - - - true - $(NoWarn);1591;1573 - diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs b/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs index a924825..e59569b 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/OpenidConnectPkce.cs @@ -1,5 +1,6 @@ using Blazored.SessionStorage; using ITfoxtec.Identity.Discovery; +using ITfoxtec.Identity.Helpers; using ITfoxtec.Identity.Messages; using ITfoxtec.Identity.Tokens; using ITfoxtec.Identity.Util; @@ -15,9 +16,6 @@ using System.Security; using System.Security.Claims; using System.Threading.Tasks; -#if NETSTANDARD -using ITfoxtec.Identity.Models; -#endif namespace ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect { @@ -27,14 +25,16 @@ public class OpenidConnectPkce protected readonly OpenidConnectPkceSettings globalOpenidClientPkceSettings; protected readonly NavigationManager navigationManager; protected readonly ISessionStorageService sessionStorage; + protected readonly OidcHelper oidcHelper; protected readonly AuthenticationStateProvider authenticationStateProvider; - public OpenidConnectPkce(IServiceProvider serviceProvider, OpenidConnectPkceSettings globalOpenidClientPkceSettings, NavigationManager navigationManager, ISessionStorageService sessionStorage, AuthenticationStateProvider authenticationStateProvider) + public OpenidConnectPkce(IServiceProvider serviceProvider, OpenidConnectPkceSettings globalOpenidClientPkceSettings, NavigationManager navigationManager, ISessionStorageService sessionStorage, OidcHelper oidcHelper, AuthenticationStateProvider authenticationStateProvider) { this.serviceProvider = serviceProvider; this.globalOpenidClientPkceSettings = globalOpenidClientPkceSettings; this.navigationManager = navigationManager; this.sessionStorage = sessionStorage; + this.oidcHelper = oidcHelper; this.authenticationStateProvider = authenticationStateProvider; } @@ -164,26 +164,7 @@ public async Task LoginCallBackAsync(string responseUrl) if (tokenResponse.AccessToken.IsNullOrEmpty()) throw new ArgumentNullException(nameof(tokenResponse.AccessToken), tokenResponse.GetTypeName()); if (tokenResponse.ExpiresIn <= 0) throw new ArgumentNullException(nameof(tokenResponse.ExpiresIn), tokenResponse.GetTypeName()); - // .NET 5.0 error, System.Security.Cryptography.RSA.Create() - System.PlatformNotSupportedException: System.Security.Cryptography.Algorithms is not supported on this platform. - // https://github.com/dotnet/aspnetcore/issues/26123 - // https://github.com/dotnet/runtime/issues/40074 - // .NET 7 - // https://github.com/dotnet/designs/blob/main/accepted/2021/blazor-wasm-crypto.md#net-7-plan -#if NETSTANDARD - var oidcDiscoveryKeySet = await GetOidcDiscoveryKeysAsync(openidClientPkceState.OidcDiscoveryUri); - - (var idTokenPrincipal, _) = JwtHandler.ValidateToken(tokenResponse.IdToken, oidcDiscovery.Issuer, oidcDiscoveryKeySet.Keys.ToMSJsonWebKeys(), openidClientPkceState.ClientId, - nameClaimType: globalOpenidClientPkceSettings.NameClaimType, roleClaimType: globalOpenidClientPkceSettings.RoleClaimType); -#else - var idTokenPrincipal = JwtHandler.ReadTokenClaims(tokenResponse.IdToken); -#endif - - var nonce = idTokenPrincipal.Claims.Where(c => c.Type == JwtClaimTypes.Nonce).Select(c => c.Value).FirstOrDefault(); - if (!openidClientPkceState.Nonce.Equals(nonce, StringComparison.Ordinal)) - { - throw new SecurityException("Nonce do not match."); - } - + var idTokenPrincipal = await oidcHelper.ValidateOidcWithUserInfoEndpoint(tokenResponse.IdToken, tokenResponse.AccessToken, openidClientPkceState.Nonce); return (idTokenPrincipal, tokenResponse); case HttpStatusCode.BadRequest: @@ -237,19 +218,7 @@ public async Task HandleRefreshTokenAsync(OidcUserSession userS if (tokenResponse.AccessToken.IsNullOrEmpty()) throw new ArgumentNullException(nameof(tokenResponse.AccessToken), tokenResponse.GetTypeName()); if (tokenResponse.ExpiresIn <= 0) throw new ArgumentNullException(nameof(tokenResponse.ExpiresIn), tokenResponse.GetTypeName()); - // .NET 5.0 error, System.Security.Cryptography.RSA.Create() - System.PlatformNotSupportedException: System.Security.Cryptography.Algorithms is not supported on this platform. - // https://github.com/dotnet/aspnetcore/issues/26123 - // https://github.com/dotnet/runtime/issues/40074 - // .NET 7 - // https://github.com/dotnet/designs/blob/main/accepted/2021/blazor-wasm-crypto.md#net-7-plan -#if NETSTANDARD - var oidcDiscoveryKeySet = await GetOidcDiscoveryKeysAsync(oidcDiscoveryUri); - - (var idTokenPrincipal, _) = JwtHandler.ValidateToken(tokenResponse.IdToken, oidcDiscovery.Issuer, oidcDiscoveryKeySet.Keys, clientId, - nameClaimType: globalOpenidClientPkceSettings.NameClaimType, roleClaimType: globalOpenidClientPkceSettings.RoleClaimType); -#else - var idTokenPrincipal = JwtHandler.ReadTokenClaims(tokenResponse.IdToken); -#endif + var idTokenPrincipal = await oidcHelper.ValidateOidcWithUserInfoEndpoint(tokenResponse.IdToken, tokenResponse.AccessToken); if (!subject.IsNullOrEmpty() && subject != idTokenPrincipal.Claims.Where(c => c.Type == globalOpenidClientPkceSettings.NameClaimType).Single().Value) { @@ -360,6 +329,7 @@ private async Task GetOidcDiscoveryAsync(string oidcDiscoveryUri) try { var oidcDiscoveryHandler = serviceProvider.GetService(); + oidcDiscoveryHandler.SetDefaultOidcDiscoveryUri(oidcDiscoveryUri); return await oidcDiscoveryHandler.GetOidcDiscoveryAsync(oidcDiscoveryUri); } catch (Exception ex) @@ -368,21 +338,6 @@ private async Task GetOidcDiscoveryAsync(string oidcDiscoveryUri) } } -#if NETSTANDARD - private async Task GetOidcDiscoveryKeysAsync(string oidcDiscoveryUri) - { - try - { - var oidcDiscoveryHandler = serviceProvider.GetService(); - return await oidcDiscoveryHandler.GetOidcDiscoveryKeysAsync(oidcDiscoveryUri); - } - catch (Exception ex) - { - throw new Exception($"Failed to fetch OIDC Discovery Keys from discovery '{oidcDiscoveryUri}'.", ex); - } - } -#endif - private async Task SaveStateAsync(OpenidConnectPkceSettings openidConnectPkceSettings, string callBackUri, string redirectUri, string codeVerifier = null, string nonce = null) { var state = RandomGenerator.GenerateNonce(32); From fc227c0a8c90261de76633101fc5850839ff3f3a Mon Sep 17 00:00:00 2001 From: Anders Revsgaard Date: Wed, 15 Nov 2023 21:27:55 +0100 Subject: [PATCH 4/5] Nuget package corrections --- .../ITfoxtec.Identity.BlazorWA.Oidc.csproj | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj index 86d49ae..c680d97 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj @@ -13,7 +13,6 @@ Support .NET 7.0 Support .NET 6.0 Support .NET 5.0 - Support .NET Standard 2.0 The received ID token is validated by the component in the client using the OpenID Provider (OP) discovery document. The component automatically handle token / session update with use of the refresh token if the offline_access scope is specified. @@ -24,13 +23,13 @@ The component automatically handle token / session update with use of the refres Blazor WebAssembly OpenID Connect (OIDC) Proof Key for Code Exchange (PKCE) id token access token refresh token true © 2020 ITfoxtec - 1.6.5.0 - 1.6.5.0 - 1.6.5 + 1.6.5.1 + 1.6.5.1 + 1.6.5.1 - + @@ -54,8 +53,8 @@ The component automatically handle token / session update with use of the refres - - + + NET70;NET @@ -72,9 +71,9 @@ The component automatically handle token / session update with use of the refres - - - + + + NET60;NET From df2f31a55d3952199658ca68f24fd7fb09a7ca7f Mon Sep 17 00:00:00 2001 From: Anders Revsgaard Date: Tue, 28 Nov 2023 10:07:46 +0100 Subject: [PATCH 5/5] Update readme Version 1.6.5.2 --- README.md | 3 ++- .../ITfoxtec.Identity.BlazorWA.Oidc.csproj | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 407b380..5f59ddb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,10 @@ # ITfoxtec.Identity.BlazorWebAssembly.OpenidConnect A JavaScript free OpenID Connect PKCE library for Blazor WebAssembly. +* **Support .NET 8.0** +* **Support .NET 7.0** * **Support .NET 6.0** * **Support .NET 5.0** -* **Support .NET Standard 2.0** The library support login and logout with OpenID Connect (OIDC) using Proof Key for Code Exchange (PKCE) instead of a client secret. The received ID token is validated by the component in the client using the OpenID Provider (OP) discovery document. diff --git a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj index c680d97..523df69 100644 --- a/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj +++ b/src/ITfoxtec.Identity.BlazorWA.Oidc/ITfoxtec.Identity.BlazorWA.Oidc.csproj @@ -23,13 +23,13 @@ The component automatically handle token / session update with use of the refres Blazor WebAssembly OpenID Connect (OIDC) Proof Key for Code Exchange (PKCE) id token access token refresh token true © 2020 ITfoxtec - 1.6.5.1 - 1.6.5.1 - 1.6.5.1 + 1.6.5.2 + 1.6.5.2 + 1.6.5.2 - +