From 8f875fad7a6d0d2112604d473c7d33fd0bc4b6dd Mon Sep 17 00:00:00 2001 From: Sean Farrow Date: Tue, 30 Jan 2024 11:45:35 +0000 Subject: [PATCH] Update samples to .Net 8.0, OpenIddict 5.1 and IdentityServer 7.0. --- .../DuendeDynamicProviders.csproj | 18 +++------ .../Pages/SecurityHeadersAttribute.cs | 10 ++--- .../DuendeIdP/DuendeIdP.csproj | 10 ++--- .../Pages/SecurityHeadersAttribute.cs | 10 ++--- .../SLO/SamlOidcSLO/Common/Common.csproj | 2 +- .../IdentityServer/IdentityServer.csproj | 36 ++++++++--------- .../Pages/SecurityHeadersAttribute.cs | 10 ++--- .../SLO/SamlOidcSLO/WebClient.OIDC/Program.cs | 2 +- .../WebClient.OIDC/WebClient.OIDC.csproj | 8 ++-- .../WebClient.SAML.1/WebClient.SAML.1.csproj | 14 ++----- .../WebClient.SAML.2/WebClient.SAML.2.csproj | 13 ++----- OpenIddict/OpenIddictIdP/OpenIddictIdP.csproj | 39 ++++++++----------- OpenIddict/OpenIddictIdP/Startup.cs | 3 +- spWithIdpInitiated/spWithIdpInitiated.csproj | 11 ++---- spWithMultipleIdps/spWithMultipleIdps.csproj | 11 ++---- spWithSingleIdp/spWithSingleIdp.csproj | 22 +++++------ 16 files changed, 89 insertions(+), 130 deletions(-) diff --git a/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj b/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj index 5df0603..b8969e8 100644 --- a/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj +++ b/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj @@ -1,22 +1,17 @@  - - net6.0 + net8.0 enable - - - - - - - + + + + - PreserveNewest @@ -25,7 +20,4 @@ PreserveNewest - - - \ No newline at end of file diff --git a/DuendeIdentityServer/DuendeDynamicProviders/Pages/SecurityHeadersAttribute.cs b/DuendeIdentityServer/DuendeDynamicProviders/Pages/SecurityHeadersAttribute.cs index 5f67293..812e960 100644 --- a/DuendeIdentityServer/DuendeDynamicProviders/Pages/SecurityHeadersAttribute.cs +++ b/DuendeIdentityServer/DuendeDynamicProviders/Pages/SecurityHeadersAttribute.cs @@ -17,13 +17,13 @@ public override void OnResultExecuting(ResultExecutingContext context) // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options")) { - context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff"); + context.HttpContext.Response.Headers.Append("X-Content-Type-Options", "nosniff"); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options if (!context.HttpContext.Response.Headers.ContainsKey("X-Frame-Options")) { - context.HttpContext.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); + context.HttpContext.Response.Headers.Append("X-Frame-Options", "SAMEORIGIN"); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy @@ -36,19 +36,19 @@ public override void OnResultExecuting(ResultExecutingContext context) // once for standards compliant browsers if (!context.HttpContext.Response.Headers.ContainsKey("Content-Security-Policy")) { - context.HttpContext.Response.Headers.Add("Content-Security-Policy", csp); + context.HttpContext.Response.Headers.Append("Content-Security-Policy", csp); } // and once again for IE if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Security-Policy")) { - context.HttpContext.Response.Headers.Add("X-Content-Security-Policy", csp); + context.HttpContext.Response.Headers.Append("X-Content-Security-Policy", csp); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy var referrer_policy = "no-referrer"; if (!context.HttpContext.Response.Headers.ContainsKey("Referrer-Policy")) { - context.HttpContext.Response.Headers.Add("Referrer-Policy", referrer_policy); + context.HttpContext.Response.Headers.Append("Referrer-Policy", referrer_policy); } } } diff --git a/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj b/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj index 9de21dd..f010e93 100644 --- a/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj +++ b/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 enable @@ -10,10 +10,10 @@ - - - + + + - + \ No newline at end of file diff --git a/DuendeIdentityServer/DuendeIdP/Pages/SecurityHeadersAttribute.cs b/DuendeIdentityServer/DuendeIdP/Pages/SecurityHeadersAttribute.cs index a4abbd2..7d21419 100644 --- a/DuendeIdentityServer/DuendeIdP/Pages/SecurityHeadersAttribute.cs +++ b/DuendeIdentityServer/DuendeIdP/Pages/SecurityHeadersAttribute.cs @@ -17,13 +17,13 @@ public override void OnResultExecuting(ResultExecutingContext context) // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options")) { - context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff"); + context.HttpContext.Response.Headers.Append("X-Content-Type-Options", "nosniff"); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options if (!context.HttpContext.Response.Headers.ContainsKey("X-Frame-Options")) { - context.HttpContext.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); + context.HttpContext.Response.Headers.Append("X-Frame-Options", "SAMEORIGIN"); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy @@ -36,19 +36,19 @@ public override void OnResultExecuting(ResultExecutingContext context) // once for standards compliant browsers if (!context.HttpContext.Response.Headers.ContainsKey("Content-Security-Policy")) { - context.HttpContext.Response.Headers.Add("Content-Security-Policy", csp); + context.HttpContext.Response.Headers.Append("Content-Security-Policy", csp); } // and once again for IE if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Security-Policy")) { - context.HttpContext.Response.Headers.Add("X-Content-Security-Policy", csp); + context.HttpContext.Response.Headers.Append("X-Content-Security-Policy", csp); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy var referrer_policy = "no-referrer"; if (!context.HttpContext.Response.Headers.ContainsKey("Referrer-Policy")) { - context.HttpContext.Response.Headers.Add("Referrer-Policy", referrer_policy); + context.HttpContext.Response.Headers.Append("Referrer-Policy", referrer_policy); } } } diff --git a/DuendeIdentityServer/SLO/SamlOidcSLO/Common/Common.csproj b/DuendeIdentityServer/SLO/SamlOidcSLO/Common/Common.csproj index 6836c68..8a91831 100644 --- a/DuendeIdentityServer/SLO/SamlOidcSLO/Common/Common.csproj +++ b/DuendeIdentityServer/SLO/SamlOidcSLO/Common/Common.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable diff --git a/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/IdentityServer.csproj b/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/IdentityServer.csproj index d5e5eca..60b98cf 100644 --- a/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/IdentityServer.csproj +++ b/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/IdentityServer.csproj @@ -1,28 +1,28 @@  - net7.0 + net8.0 enable 38ced442-cf32-4289-bb08-57d4a78831b3 - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + diff --git a/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/Pages/SecurityHeadersAttribute.cs b/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/Pages/SecurityHeadersAttribute.cs index 0908172..3e8acd3 100644 --- a/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/Pages/SecurityHeadersAttribute.cs +++ b/DuendeIdentityServer/SLO/SamlOidcSLO/IdentityServer/Pages/SecurityHeadersAttribute.cs @@ -17,13 +17,13 @@ public override void OnResultExecuting(ResultExecutingContext context) // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Type-Options")) { - context.HttpContext.Response.Headers.Add("X-Content-Type-Options", "nosniff"); + context.HttpContext.Response.Headers.Append("X-Content-Type-Options", "nosniff"); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options if (!context.HttpContext.Response.Headers.ContainsKey("X-Frame-Options")) { - context.HttpContext.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); + context.HttpContext.Response.Headers.Append("X-Frame-Options", "SAMEORIGIN"); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy @@ -36,19 +36,19 @@ public override void OnResultExecuting(ResultExecutingContext context) // once for standards compliant browsers if (!context.HttpContext.Response.Headers.ContainsKey("Content-Security-Policy")) { - context.HttpContext.Response.Headers.Add("Content-Security-Policy", csp); + context.HttpContext.Response.Headers.Append("Content-Security-Policy", csp); } // and once again for IE if (!context.HttpContext.Response.Headers.ContainsKey("X-Content-Security-Policy")) { - context.HttpContext.Response.Headers.Add("X-Content-Security-Policy", csp); + context.HttpContext.Response.Headers.Append("X-Content-Security-Policy", csp); } // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy var referrer_policy = "no-referrer"; if (!context.HttpContext.Response.Headers.ContainsKey("Referrer-Policy")) { - context.HttpContext.Response.Headers.Add("Referrer-Policy", referrer_policy); + context.HttpContext.Response.Headers.Append("Referrer-Policy", referrer_policy); } } } diff --git a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/Program.cs b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/Program.cs index e5d1339..981dca7 100644 --- a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/Program.cs +++ b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/Program.cs @@ -51,7 +51,7 @@ app.Use(async (context, next) => { - context.Response.Headers.Add("X-Frame-Options", "SAMEORIGIN"); + context.Response.Headers.Append("X-Frame-Options", "SAMEORIGIN"); await next(); }); diff --git a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/WebClient.OIDC.csproj b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/WebClient.OIDC.csproj index c473d56..bca54a6 100644 --- a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/WebClient.OIDC.csproj +++ b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.OIDC/WebClient.OIDC.csproj @@ -1,16 +1,16 @@ - net7.0 + net8.0 enable enable WebClient - - - + + + diff --git a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.1/WebClient.SAML.1.csproj b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.1/WebClient.SAML.1.csproj index fbec043..70fba60 100644 --- a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.1/WebClient.SAML.1.csproj +++ b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.1/WebClient.SAML.1.csproj @@ -1,26 +1,20 @@  - - net7.0 + net8.0 enable enable WebClient - - - - + + - PreserveNewest - - - + \ No newline at end of file diff --git a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.2/WebClient.SAML.2.csproj b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.2/WebClient.SAML.2.csproj index b394960..70fba60 100644 --- a/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.2/WebClient.SAML.2.csproj +++ b/DuendeIdentityServer/SLO/SamlOidcSLO/WebClient.SAML.2/WebClient.SAML.2.csproj @@ -1,25 +1,20 @@  - - net7.0 + net8.0 enable enable WebClient - - - - + + - PreserveNewest - - + \ No newline at end of file diff --git a/OpenIddict/OpenIddictIdP/OpenIddictIdP.csproj b/OpenIddict/OpenIddictIdP/OpenIddictIdP.csproj index cd242d8..b2eab57 100644 --- a/OpenIddict/OpenIddictIdP/OpenIddictIdP.csproj +++ b/OpenIddict/OpenIddictIdP/OpenIddictIdP.csproj @@ -1,35 +1,29 @@  - - net7.0 + net8.0 false - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + - PreserveNewest @@ -38,5 +32,4 @@ PreserveNewest - - + \ No newline at end of file diff --git a/OpenIddict/OpenIddictIdP/Startup.cs b/OpenIddict/OpenIddictIdP/Startup.cs index c92e88e..8bcf342 100644 --- a/OpenIddict/OpenIddictIdP/Startup.cs +++ b/OpenIddict/OpenIddictIdP/Startup.cs @@ -11,8 +11,8 @@ using Rsk.Saml.Configuration; using Rsk.Saml.OpenIddict.AspNetCore.Identity.Configuration.DependencyInjection; using Rsk.Saml.OpenIddict.Configuration.DependencyInjection; -using Rsk.Saml.OpenIddict.EntityFrameworkCore.Configuration.DependacyInjection; using openiddictidp.Data; +using Rsk.Saml.OpenIddict.EntityFrameworkCore.Configuration.DependencyInjection; using Rsk.Saml.Samples; using static OpenIddict.Abstractions.OpenIddictConstants; @@ -61,7 +61,6 @@ public void ConfigureServices(IServiceCollection services) // (like pruning orphaned authorizations/tokens from the database) at regular intervals. services.AddQuartz(options => { - options.UseMicrosoftDependencyInjectionJobFactory(); options.UseSimpleTypeLoader(); options.UseInMemoryStore(); }); diff --git a/spWithIdpInitiated/spWithIdpInitiated.csproj b/spWithIdpInitiated/spWithIdpInitiated.csproj index 608c977..e56abed 100644 --- a/spWithIdpInitiated/spWithIdpInitiated.csproj +++ b/spWithIdpInitiated/spWithIdpInitiated.csproj @@ -1,21 +1,16 @@  - - net6.0 + net8.0 - - - + - PreserveNewest - - + \ No newline at end of file diff --git a/spWithMultipleIdps/spWithMultipleIdps.csproj b/spWithMultipleIdps/spWithMultipleIdps.csproj index f6f7919..3cbcf4c 100644 --- a/spWithMultipleIdps/spWithMultipleIdps.csproj +++ b/spWithMultipleIdps/spWithMultipleIdps.csproj @@ -1,17 +1,13 @@  - - net6.0 + net8.0 - - - + - PreserveNewest @@ -20,5 +16,4 @@ PreserveNewest - - + \ No newline at end of file diff --git a/spWithSingleIdp/spWithSingleIdp.csproj b/spWithSingleIdp/spWithSingleIdp.csproj index ea08391..e4797b7 100644 --- a/spWithSingleIdp/spWithSingleIdp.csproj +++ b/spWithSingleIdp/spWithSingleIdp.csproj @@ -1,17 +1,13 @@  - - - net6.0 - enable - enable - - + + net8.0 + enable + enable + - - - - - - + + + + \ No newline at end of file