diff --git a/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj b/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj index 4aa25fe..15ec245 100644 --- a/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj +++ b/DuendeIdentityServer/DuendeDynamicProviders/DuendeDynamicProviders.csproj @@ -1,17 +1,13 @@  - net5.0 + net6.0 - - - - - - - - + + + + @@ -23,6 +19,9 @@ PreserveNewest + + PreserveNewest + \ No newline at end of file diff --git a/DuendeIdentityServer/DuendeDynamicProviders/Startup.cs b/DuendeIdentityServer/DuendeDynamicProviders/Startup.cs index e12d4d7..49fdb9c 100644 --- a/DuendeIdentityServer/DuendeDynamicProviders/Startup.cs +++ b/DuendeIdentityServer/DuendeDynamicProviders/Startup.cs @@ -35,8 +35,8 @@ public void ConfigureServices(IServiceCollection services) builder.AddSamlDynamicProvider(options => { // unstorable/reusable data, such as license information and events. This will override the data stored - options.Licensee = ""; - options.LicenseKey = ""; + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; }) // Use EntityFramework store for storing identity providers diff --git a/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj b/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj index 73f0dcc..d67ca66 100644 --- a/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj +++ b/DuendeIdentityServer/DuendeIdP/DuendeIdP.csproj @@ -1,13 +1,13 @@ - net5.0 + net6.0 - - - + + + diff --git a/DuendeIdentityServer/DuendeIdP/Startup.cs b/DuendeIdentityServer/DuendeIdP/Startup.cs index 5a7fe78..0c5d661 100644 --- a/DuendeIdentityServer/DuendeIdP/Startup.cs +++ b/DuendeIdentityServer/DuendeIdP/Startup.cs @@ -53,8 +53,8 @@ public void ConfigureServices(IServiceCollection services) builder.AddSamlPlugin(options => { - options.Licensee = ""; - options.LicenseKey = ""; + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; options.WantAuthenticationRequestsSigned = false; }) diff --git a/DuendeIdentityServer/DuendeIdP/keys/is-signing-key-B10AAF48CB2F925ED8E431B8A3A1EF09.json b/DuendeIdentityServer/DuendeIdP/keys/is-signing-key-B10AAF48CB2F925ED8E431B8A3A1EF09.json new file mode 100644 index 0000000..37dc381 --- /dev/null +++ b/DuendeIdentityServer/DuendeIdP/keys/is-signing-key-B10AAF48CB2F925ED8E431B8A3A1EF09.json @@ -0,0 +1 @@ +{"Version":1,"Id":"B10AAF48CB2F925ED8E431B8A3A1EF09","Created":"2021-12-06T22:14:42.9754091Z","Algorithm":"RS256","IsX509Certificate":true,"Data":"CfDJ8Gb-JiW3czNGk_YLGkrTDWKMH7ufW7-5XrKDIHbL7PZd-EDF7pfKVA8Y_xYxrGEqpYnZ2skm_GjKc9MY_5nfxpZKEEiXXdVQClAtxrkfBJHrrO48_B-Cv2rtZyeJKYAEchE_DaPyepKuVSna2eoV-kQNEBZA0USrXiSVTajaQU5fJR-ec7TSSKDnkasIpVBanIZKcruZYhmHLtvCh59-EfSsdP3jWAqADwvqbcIu4-dXE_Wy-3ZwwGWPWb8FUvdkY9scMgeU6sFXeB54f1vLXf_LRUQ-4kUrRhChwTLxHRCP6VY2EqNyXlc9ebr3u0GP5Gifbu4sOu_FBueTGKDRmrzqh-pLJB3cDvKcBSm_9Wp0j9_qs9Aq8qW4c-gK8CWbmjPKxpZvTPdd3sb1EtHAmi51hf-ozA28427TKoUAwbg2XfINvbILAWEq6FHlsthV2Wl8l5snQLdlx_oqWjOmHYiV7XiNMMoSvW4Z4QlWQg58W7xv30eiOoSPND68lpn0kU10EfrPnfU_tDlMYtu1msQT34qxobHk8OZhXNRf140v-Cr89b1GtpBq-sbkU5R_q0kH0aMDsSES6XIBwT6BSkzlMM503ZyfHf822TNypgHNgPKHYPVuFzXurobg9nw-3tu_mZdiFuPr_C-4Ug_3ozi4Tsegi9lbP4WK888nq0jPyi77PFiantUNdQY606AOZe7CnJy7lswrw4aDPT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rJHnmD5fsZYJdbDlTvgt_e_Zhd9v187g6kWr6dCVqjutdr5aMcCPkJVaazmqYcyLNlwrvJ1wBCXyqfI8ug9ORQdu_JDdUva6rW28nGUl24doD2mXzrgFlB6b6tQI76JUmh7Z1T4jAtjp_KHeDjh5t4RFNPLtsJIDIdG73SM1fBYj17DQmTmWlY5f3bkD4WrT0LiE5rep-uBLET4fDLL9GLP7WtBOv7DCYEs1aUNbn6mfvvPFmMyhYpvTip7GM40NRD2I-uYQ8Tl9tc5Bs4gPe1SLs9lqjraE2q72loIBj5hXfA3Hvfkb28FmRpALzlWex2380y6VeQzqQGKIqTAKT6wmSAaXk3qnnjySsZpE7kyDcLNXhuX4g5YHjlo7wHokB_pxLK3boslNVryOCPQvN9hYAWnbPR-a99V844oCdHhpkha58T1I2OfEufsFxZjbh-xWAUOOCGBP27AlGMRJoWaDz2CZ48ns6V21SFmRkE29gZyDZMyG0TXUmcG8fxTGnjcVuXmfqpDEOdRBed89MZzeSJ3uBGNrQF8h9fIEKXC3PYxpLsn3yShUXeZWBqKTZVi6jov6akLEHQiVuKjAjOljcP4t7T2x6xgf6TjkQO5qfpHkYs3XdPLuP1qOBYuUWNZ_aqEVeQC5K0FwCRcNtnzce8fKKTSNS7UVTTwu4UqVjeOSN_dD37zCqQf2JxcX_DjEf7cIMJ584qkonp2Lb0CNTVBqmXMHfdGAl6REBBTeeRXeq8mwRwQjkYkSEi5Q8FzieSevbYoNCNvYZIaaDsocHX7Nk7Pg_PIRTfboIzFn-2CC1TZwGXs3T7sHaBielAO6pPYrBGJp9avSsKVnAh2Xqu08T2cIBYPcM3gu13KJSdqWoFg","DataProtected":true} \ No newline at end of file diff --git a/IdentityServer4/idp/Startup.cs b/IdentityServer4/idp/Startup.cs index 4d6a260..f65f5d3 100644 --- a/IdentityServer4/idp/Startup.cs +++ b/IdentityServer4/idp/Startup.cs @@ -30,8 +30,8 @@ public void ConfigureServices(IServiceCollection services) // Configure SAML Identity Provider and authorized Service Providers builder.AddSamlPlugin(options => { - options.Licensee = ""; - options.LicenseKey = ""; + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; options.WantAuthenticationRequestsSigned = false; }) diff --git a/IdentityServer4/idp/idp.csproj b/IdentityServer4/idp/idp.csproj index 5dbdaea..bb6f103 100644 --- a/IdentityServer4/idp/idp.csproj +++ b/IdentityServer4/idp/idp.csproj @@ -5,9 +5,9 @@ - - - + + + diff --git a/IdentityServer4/idpWithEf/Startup.cs b/IdentityServer4/idpWithEf/Startup.cs index 87aa795..221f4aa 100644 --- a/IdentityServer4/idpWithEf/Startup.cs +++ b/IdentityServer4/idpWithEf/Startup.cs @@ -41,8 +41,8 @@ public void ConfigureServices(IServiceCollection services) // Configure SAML Identity Provider and authorized Service Providers builder.AddSamlPlugin(options => { - options.Licensee = ""; - options.LicenseKey = ""; + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; options.WantAuthenticationRequestsSigned = false; }) diff --git a/IdentityServer4/idpWithEf/idpWithEf.csproj b/IdentityServer4/idpWithEf/idpWithEf.csproj index 5b96027..fb40feb 100644 --- a/IdentityServer4/idpWithEf/idpWithEf.csproj +++ b/IdentityServer4/idpWithEf/idpWithEf.csproj @@ -5,11 +5,11 @@ - - - - - + + + + + diff --git a/IdentityServer4/idpWithIdpInitiated/Startup.cs b/IdentityServer4/idpWithIdpInitiated/Startup.cs index 0e6395a..f5f2812 100644 --- a/IdentityServer4/idpWithIdpInitiated/Startup.cs +++ b/IdentityServer4/idpWithIdpInitiated/Startup.cs @@ -30,8 +30,8 @@ public void ConfigureServices(IServiceCollection services) // Configure SAML Identity Provider and authorized Service Providers builder.AddSamlPlugin(options => { - options.Licensee = ""; - options.LicenseKey = ""; + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; options.WantAuthenticationRequestsSigned = false; }) diff --git a/IdentityServer4/idpWithIdpInitiated/idpWithIdpInitiated.csproj b/IdentityServer4/idpWithIdpInitiated/idpWithIdpInitiated.csproj index 5dbdaea..bb6f103 100644 --- a/IdentityServer4/idpWithIdpInitiated/idpWithIdpInitiated.csproj +++ b/IdentityServer4/idpWithIdpInitiated/idpWithIdpInitiated.csproj @@ -5,9 +5,9 @@ - - - + + + diff --git a/IdentityServer4/sp/Startup.cs b/IdentityServer4/sp/Startup.cs index b937418..cfd8b69 100644 --- a/IdentityServer4/sp/Startup.cs +++ b/IdentityServer4/sp/Startup.cs @@ -30,8 +30,8 @@ public void ConfigureServices(IServiceCollection services) // OPTIONAL - only required if you want to be a SAML IdP too builder.AddSamlPlugin(options => { - options.Licensee = ""; - options.LicenseKey = ""; + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; options.WantAuthenticationRequestsSigned = false; }) diff --git a/IdentityServer4/sp/sp.csproj b/IdentityServer4/sp/sp.csproj index 1d4d837..ce263c2 100644 --- a/IdentityServer4/sp/sp.csproj +++ b/IdentityServer4/sp/sp.csproj @@ -5,9 +5,9 @@ - - - + + + diff --git a/spWithIdpInitiated/Program.cs b/spWithIdpInitiated/Program.cs deleted file mode 100644 index c6f8d8a..0000000 --- a/spWithIdpInitiated/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; - -namespace spWithIdpInitiated -{ - public class Program - { - public static void Main(string[] args) - { - BuildWebHost(args).Run(); - } - - public static IWebHost BuildWebHost(string[] args) - { - return WebHost.CreateDefaultBuilder(args) - .UseStartup() - .Build(); - } - } -} \ No newline at end of file diff --git a/spWithIdpInitiated/Startup.cs b/spWithIdpInitiated/Startup.cs index c790ffe..7555104 100644 --- a/spWithIdpInitiated/Startup.cs +++ b/spWithIdpInitiated/Startup.cs @@ -1,61 +1,54 @@ -using System.Collections.Generic; -using System.Security.Cryptography.X509Certificates; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Rsk.AspNetCore.Authentication.Saml2p; +using System.Collections.Generic; +using System.Security.Cryptography.X509Certificates; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddControllersWithViews(); -namespace spWithIdpInitiated -{ - public class Startup - { - public void ConfigureServices(IServiceCollection services) +builder.Services.AddAuthentication() + .AddCookie("cookie") + .AddSaml2p("saml2p", options => { + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; + + options.IdentityProviderOptions = new IdpOptions { - services.AddControllersWithViews(); - - services.AddAuthentication() - .AddCookie("cookie") - .AddSaml2p("saml2p", options => { - options.Licensee = ""; - options.LicenseKey = ""; - - options.IdentityProviderOptions = new IdpOptions - { - EntityId = "https://localhost:5000", - SigningCertificates = new List { new X509Certificate2("idsrv3test.cer") }, - SingleSignOnEndpoint = new SamlEndpoint("https://localhost:5000/saml/sso", SamlBindingTypes.HttpRedirect), - SingleLogoutEndpoint = new SamlEndpoint("https://localhost:5000/saml/slo", SamlBindingTypes.HttpRedirect), - }; - - options.ServiceProviderOptions = new SpOptions - { - EntityId = "https://localhost:5001/saml", - MetadataPath = "/saml/metadata", - SignAuthenticationRequests = false - }; - - options.NameIdClaimType = "sub"; - options.CallbackPath = "/signin-saml"; - options.SignInScheme = "cookie"; - - // IdP-Initiated SSO - options.AllowIdpInitiatedSso = true; - options.IdPInitiatedSsoCompletionPath = "/"; - }); - } - - public void Configure(IApplicationBuilder app) + EntityId = "https://localhost:5000", + SigningCertificates = new List { new X509Certificate2("idsrv3test.cer") }, + SingleSignOnEndpoint = new SamlEndpoint("https://localhost:5000/saml/sso", SamlBindingTypes.HttpRedirect), + SingleLogoutEndpoint = new SamlEndpoint("https://localhost:5000/saml/slo", SamlBindingTypes.HttpRedirect), + }; + + options.ServiceProviderOptions = new SpOptions { - app.UseHttpsRedirection(); + EntityId = "https://localhost:5001/saml", + MetadataPath = "/saml/metadata", + SignAuthenticationRequests = false + }; + + options.NameIdClaimType = "sub"; + options.CallbackPath = "/signin-saml"; + options.SignInScheme = "cookie"; + + // IdP-Initiated SSO + options.AllowIdpInitiatedSso = true; + options.IdPInitiatedSsoCompletionPath = "/"; + }); + +var app = builder.Build(); + +app.UseHttpsRedirection(); - app.UseDeveloperExceptionPage(); +app.UseStaticFiles(); +app.UseRouting(); - app.UseStaticFiles(); - app.UseRouting(); +app.UseAuthentication(); +app.UseAuthorization(); - app.UseAuthentication(); - app.UseAuthorization(); +app.MapDefaultControllerRoute(); - app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute()); - } - } -} \ No newline at end of file +app.Run(); diff --git a/spWithIdpInitiated/spWithIdpInitiated.csproj b/spWithIdpInitiated/spWithIdpInitiated.csproj index 1d9fe15..896d07c 100644 --- a/spWithIdpInitiated/spWithIdpInitiated.csproj +++ b/spWithIdpInitiated/spWithIdpInitiated.csproj @@ -1,11 +1,11 @@  - netcoreapp3.1 + net6.0 - + diff --git a/spWithMultipleIdps/Program.cs b/spWithMultipleIdps/Program.cs deleted file mode 100644 index 09162a7..0000000 --- a/spWithMultipleIdps/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; - -namespace spWithMultipleIdps -{ - public class Program - { - public static void Main(string[] args) - { - BuildWebHost(args).Run(); - } - - public static IWebHost BuildWebHost(string[] args) - { - return WebHost.CreateDefaultBuilder(args) - .UseStartup() - .Build(); - } - } -} \ No newline at end of file diff --git a/spWithMultipleIdps/Startup.cs b/spWithMultipleIdps/Startup.cs index 96c24ef..9715ab5 100644 --- a/spWithMultipleIdps/Startup.cs +++ b/spWithMultipleIdps/Startup.cs @@ -3,95 +3,88 @@ using Microsoft.Extensions.DependencyInjection; using Rsk.AspNetCore.Authentication.Saml2p; -namespace spWithMultipleIdps -{ - public class Startup - { - public void ConfigureServices(IServiceCollection services) +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddControllersWithViews(); + +builder.Services.AddAuthentication() + .AddCookie("cookie") + .AddSaml2p("idp1", options => { + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; + + options.IdentityProviderOptions = new IdpOptions { - services.AddControllersWithViews(); - - services.AddAuthentication() - .AddCookie("cookie") - .AddSaml2p("idp1", options => { - options.Licensee = ""; - options.LicenseKey = ""; - - options.IdentityProviderOptions = new IdpOptions - { - EntityId = "https://localhost:5000", - SigningCertificates = { new X509Certificate2("idsrv3test.cer") }, - SingleSignOnEndpoint = new SamlEndpoint("https://localhost:5000/saml/sso", SamlBindingTypes.HttpRedirect), - SingleLogoutEndpoint = new SamlEndpoint("https://localhost:5000/saml/slo", SamlBindingTypes.HttpRedirect), - }; - - options.ServiceProviderOptions = new SpOptions - { - EntityId = "https://localhost:5002/saml", - MetadataPath = "/saml/metadata-saml-1", - SignAuthenticationRequests = false - }; - - options.NameIdClaimType = "sub"; - options.CallbackPath = "/signin-saml-1"; - options.SignInScheme = "cookie"; - }) - .AddSaml2p("idp2", options => { - options.Licensee = ""; - options.LicenseKey = ""; - - options.IdentityProviderOptions = new IdpOptions - { - EntityId = "https://localhost:5001", - SigningCertificates = {new X509Certificate2("testclient.cer")}, - SingleSignOnEndpoint = new SamlEndpoint("https://localhost:5001/saml/sso", SamlBindingTypes.HttpRedirect), - SingleLogoutEndpoint = new SamlEndpoint("https://localhost:5001/saml/slo", SamlBindingTypes.HttpRedirect), - }; - - options.ServiceProviderOptions = new SpOptions - { - EntityId = "https://localhost:5002/saml", - MetadataPath = "/saml/metadata-saml-2", - SignAuthenticationRequests = false - }; - - options.NameIdClaimType = "sub"; - options.CallbackPath = "/signin-saml-2"; - options.SignInScheme = "cookie"; - }) - .AddSaml2p("duende", options => - { - options.Licensee = ""; - options.LicenseKey = ""; - - options.IdentityProviderMetadataAddress = "https://localhost:5003/saml/metadata"; - - options.ServiceProviderOptions = new SpOptions - { - EntityId = "https://localhost:5002/saml", - MetadataPath = "/saml/metadata-saml-3", - SignAuthenticationRequests = false - }; - - options.NameIdClaimType = "sub"; - options.CallbackPath = "/signin-saml-3"; - options.SignInScheme = "cookie"; - }); - } - - public void Configure(IApplicationBuilder app) + EntityId = "https://localhost:5000", + SigningCertificates = { new X509Certificate2("idsrv3test.cer") }, + SingleSignOnEndpoint = new SamlEndpoint("https://localhost:5000/saml/sso", SamlBindingTypes.HttpRedirect), + SingleLogoutEndpoint = new SamlEndpoint("https://localhost:5000/saml/slo", SamlBindingTypes.HttpRedirect), + }; + + options.ServiceProviderOptions = new SpOptions + { + EntityId = "https://localhost:5002/saml", + MetadataPath = "/saml/metadata-saml-1", + SignAuthenticationRequests = false + }; + + options.NameIdClaimType = "sub"; + options.CallbackPath = "/signin-saml-1"; + options.SignInScheme = "cookie"; + }) + .AddSaml2p("idp2", options => { + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; + + options.IdentityProviderOptions = new IdpOptions + { + EntityId = "https://localhost:5001", + SigningCertificates = { new X509Certificate2("testclient.cer") }, + SingleSignOnEndpoint = new SamlEndpoint("https://localhost:5001/saml/sso", SamlBindingTypes.HttpRedirect), + SingleLogoutEndpoint = new SamlEndpoint("https://localhost:5001/saml/slo", SamlBindingTypes.HttpRedirect), + }; + + options.ServiceProviderOptions = new SpOptions { - app.UseHttpsRedirection(); + EntityId = "https://localhost:5002/saml", + MetadataPath = "/saml/metadata-saml-2", + SignAuthenticationRequests = false + }; + + options.NameIdClaimType = "sub"; + options.CallbackPath = "/signin-saml-2"; + options.SignInScheme = "cookie"; + }) + .AddSaml2p("duende", options => + { + options.Licensee = "your DEMO Licensee"; + options.LicenseKey = "your DEMO LicenseKey"; + + options.IdentityProviderMetadataAddress = "https://localhost:5003/saml/metadata"; + + options.ServiceProviderOptions = new SpOptions + { + EntityId = "https://localhost:5002/saml", + MetadataPath = "/saml/metadata-saml-3", + SignAuthenticationRequests = false + }; + + options.NameIdClaimType = "sub"; + options.CallbackPath = "/signin-saml-3"; + options.SignInScheme = "cookie"; + }); + +var app = builder.Build(); + +app.UseHttpsRedirection(); - app.UseDeveloperExceptionPage(); +app.UseStaticFiles(); +app.UseRouting(); - app.UseStaticFiles(); - app.UseRouting(); +app.UseAuthentication(); +app.UseAuthorization(); - app.UseAuthentication(); - app.UseAuthorization(); +app.MapDefaultControllerRoute(); - app.UseEndpoints(endpoints => endpoints.MapDefaultControllerRoute()); - } - } -} \ No newline at end of file +app.Run(); diff --git a/spWithMultipleIdps/spWithMultipleIdps.csproj b/spWithMultipleIdps/spWithMultipleIdps.csproj index 6c242d3..3191ab2 100644 --- a/spWithMultipleIdps/spWithMultipleIdps.csproj +++ b/spWithMultipleIdps/spWithMultipleIdps.csproj @@ -1,11 +1,11 @@  - netcoreapp3.1 + net6.0 - +