From db889ac6bf9f911bfd6fa55f91f291d5b5cf691a Mon Sep 17 00:00:00 2001 From: Taylor Southwick Date: Thu, 5 Dec 2024 19:09:38 -0800 Subject: [PATCH] Add remote session e2e sample --- Microsoft.AspNetCore.SystemWebAdapters.sln | 28 +++- samples/ClassLibrary/ClassLibrary.csproj | 8 +- samples/Directory.Packages.props | 62 +++++++++ .../FrameworkSampleUtilities.csproj | 13 +- .../MachineKeyFramework.csproj | 6 +- .../MachineKey/MachineKeyFramework/Web.config | 88 +++++++++++- .../Bearer/RemoteBearer/RemoteBearer.csproj | 43 ++---- .../RemoteAuth/Bearer/RemoteBearer/Web.config | 32 ++++- .../RemoteBearerCore/RemoteBearerCore.csproj | 4 +- .../Forms/FormsAuth/FormsAuth.csproj | 31 +++-- samples/RemoteAuth/Forms/FormsAuth/Web.config | 18 +++ .../Forms/FormsAuthCore/FormsAuthCore.csproj | 4 +- .../RemoteAuth/Identity/MvcApp/MvcApp.csproj | 127 +++++------------- samples/RemoteAuth/Identity/MvcApp/Web.config | 16 ++- .../Identity/MvcCoreApp/MvcCoreApp.csproj | 4 +- .../RemoteAuth/OIDC/OIDCAuth/OIDCAuth.csproj | 66 +++------ samples/RemoteAuth/OIDC/OIDCAuth/Web.config | 34 +++-- .../OIDC/OIDCAuthCore/OIDCAuthCore.csproj | 4 +- samples/RemoteSession/README.md | 9 ++ .../RemoteSessionCore/Program.cs | 47 +++++++ .../Properties/launchSettings.json | 37 +++++ .../RemoteSessionCore.csproj | 14 ++ .../appsettings.Development.json | 9 ++ .../RemoteSessionCore/appsettings.json | 14 ++ .../RemoteSessionCore/wwwroot/favicon.ico | Bin 0 -> 5430 bytes .../RemoteSessionFramework/Global.asax | 1 + .../RemoteSessionFramework/Global.asax.cs | 42 ++++++ .../Properties/launchSettings.json | 17 +++ .../RemoteSessionFramework.csproj | 13 ++ .../RemoteSessionFramework/SessionInfo.cs | 23 ++++ .../RemoteSessionFramework/Web.Debug.config | 30 +++++ .../RemoteSessionFramework/Web.Release.config | 31 +++++ .../RemoteSessionFramework/Web.config | 50 +++++++ .../BlazorCore/BlazorCore.csproj | 13 +- .../WebFormsToBlazor/BlazorCore/Program.cs | 4 +- .../WebFormsFramework/Web.config | 22 ++- .../WebFormsFramework.csproj | 45 ++----- samples/WindowsAuth/WindowsAuth.csproj | 12 +- 38 files changed, 732 insertions(+), 289 deletions(-) create mode 100644 samples/Directory.Packages.props create mode 100644 samples/RemoteSession/README.md create mode 100644 samples/RemoteSession/RemoteSessionCore/Program.cs create mode 100644 samples/RemoteSession/RemoteSessionCore/Properties/launchSettings.json create mode 100644 samples/RemoteSession/RemoteSessionCore/RemoteSessionCore.csproj create mode 100644 samples/RemoteSession/RemoteSessionCore/appsettings.Development.json create mode 100644 samples/RemoteSession/RemoteSessionCore/appsettings.json create mode 100644 samples/RemoteSession/RemoteSessionCore/wwwroot/favicon.ico create mode 100644 samples/RemoteSession/RemoteSessionFramework/Global.asax create mode 100644 samples/RemoteSession/RemoteSessionFramework/Global.asax.cs create mode 100644 samples/RemoteSession/RemoteSessionFramework/Properties/launchSettings.json create mode 100644 samples/RemoteSession/RemoteSessionFramework/RemoteSessionFramework.csproj create mode 100644 samples/RemoteSession/RemoteSessionFramework/SessionInfo.cs create mode 100644 samples/RemoteSession/RemoteSessionFramework/Web.Debug.config create mode 100644 samples/RemoteSession/RemoteSessionFramework/Web.Release.config create mode 100644 samples/RemoteSession/RemoteSessionFramework/Web.config diff --git a/Microsoft.AspNetCore.SystemWebAdapters.sln b/Microsoft.AspNetCore.SystemWebAdapters.sln index fe8075eec..175f88dfe 100644 --- a/Microsoft.AspNetCore.SystemWebAdapters.sln +++ b/Microsoft.AspNetCore.SystemWebAdapters.sln @@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{9591 ProjectSection(SolutionItems) = preProject samples\Directory.Build.props = samples\Directory.Build.props samples\Directory.Build.targets = samples\Directory.Build.targets + samples\Directory.Packages.props = samples\Directory.Packages.props samples\README.md = samples\README.md EndProjectSection EndProject @@ -105,6 +106,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrameworkSampleUtilities", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsAuth", "samples\WindowsAuth\WindowsAuth.csproj", "{B5E840F8-2021-4175-BFBF-F9447506242E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RemoteSession", "RemoteSession", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteSessionCore", "samples\RemoteSession\RemoteSessionCore\RemoteSessionCore.csproj", "{291686C8-E398-CCDC-E25C-A3C550E091FE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RemoteSessionFramework", "samples\RemoteSession\RemoteSessionFramework\RemoteSessionFramework.csproj", "{6986975A-EC36-EB8F-65B9-CB64A16355B2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -227,14 +234,22 @@ Global {E4D9A131-DC4E-403F-A10F-65F5E5E42475}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4D9A131-DC4E-403F-A10F-65F5E5E42475}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4D9A131-DC4E-403F-A10F-65F5E5E42475}.Release|Any CPU.Build.0 = Release|Any CPU - {B5E840F8-2021-4175-BFBF-F9447506242E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B5E840F8-2021-4175-BFBF-F9447506242E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B5E840F8-2021-4175-BFBF-F9447506242E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B5E840F8-2021-4175-BFBF-F9447506242E}.Release|Any CPU.Build.0 = Release|Any CPU {7F09946A-3D08-4A34-9C6A-F1D6557E4FAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7F09946A-3D08-4A34-9C6A-F1D6557E4FAD}.Debug|Any CPU.Build.0 = Debug|Any CPU {7F09946A-3D08-4A34-9C6A-F1D6557E4FAD}.Release|Any CPU.ActiveCfg = Release|Any CPU {7F09946A-3D08-4A34-9C6A-F1D6557E4FAD}.Release|Any CPU.Build.0 = Release|Any CPU + {B5E840F8-2021-4175-BFBF-F9447506242E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B5E840F8-2021-4175-BFBF-F9447506242E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B5E840F8-2021-4175-BFBF-F9447506242E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B5E840F8-2021-4175-BFBF-F9447506242E}.Release|Any CPU.Build.0 = Release|Any CPU + {291686C8-E398-CCDC-E25C-A3C550E091FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {291686C8-E398-CCDC-E25C-A3C550E091FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {291686C8-E398-CCDC-E25C-A3C550E091FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {291686C8-E398-CCDC-E25C-A3C550E091FE}.Release|Any CPU.Build.0 = Release|Any CPU + {6986975A-EC36-EB8F-65B9-CB64A16355B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6986975A-EC36-EB8F-65B9-CB64A16355B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6986975A-EC36-EB8F-65B9-CB64A16355B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6986975A-EC36-EB8F-65B9-CB64A16355B2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -277,8 +292,11 @@ Global {FA39AC22-0725-4532-A682-B054ADA5BDA2} = {03E4CEAB-D845-402A-9311-F7390B24BA2A} {17055F45-E79A-41EF-825E-0B2211433729} = {A1BDA50C-D70B-416C-97F1-74B0649797C5} {E4D9A131-DC4E-403F-A10F-65F5E5E42475} = {A1BDA50C-D70B-416C-97F1-74B0649797C5} - {B5E840F8-2021-4175-BFBF-F9447506242E} = {95915611-30BF-4AFF-AE41-5CDC6F57DCF7} {7F09946A-3D08-4A34-9C6A-F1D6557E4FAD} = {95915611-30BF-4AFF-AE41-5CDC6F57DCF7} + {B5E840F8-2021-4175-BFBF-F9447506242E} = {95915611-30BF-4AFF-AE41-5CDC6F57DCF7} + {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {95915611-30BF-4AFF-AE41-5CDC6F57DCF7} + {291686C8-E398-CCDC-E25C-A3C550E091FE} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} + {6986975A-EC36-EB8F-65B9-CB64A16355B2} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {DABA3C65-9D74-4EB6-9B1C-730328710EAD} diff --git a/samples/ClassLibrary/ClassLibrary.csproj b/samples/ClassLibrary/ClassLibrary.csproj index 66e9355f1..33e07c0f6 100644 --- a/samples/ClassLibrary/ClassLibrary.csproj +++ b/samples/ClassLibrary/ClassLibrary.csproj @@ -1,15 +1,11 @@ - netstandard2.0 - - - + - - + \ No newline at end of file diff --git a/samples/Directory.Packages.props b/samples/Directory.Packages.props new file mode 100644 index 000000000..2233338a3 --- /dev/null +++ b/samples/Directory.Packages.props @@ -0,0 +1,62 @@ + + + true + true + $(NoWarn);NU1507;NU1902 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/FrameworkSampleUtilities/FrameworkSampleUtilities.csproj b/samples/FrameworkSampleUtilities/FrameworkSampleUtilities.csproj index e9eaa0583..b3e75ff9d 100644 --- a/samples/FrameworkSampleUtilities/FrameworkSampleUtilities.csproj +++ b/samples/FrameworkSampleUtilities/FrameworkSampleUtilities.csproj @@ -1,23 +1,18 @@ - net481 enable enable - - - - - - + + + - - + \ No newline at end of file diff --git a/samples/MachineKey/MachineKeyFramework/MachineKeyFramework.csproj b/samples/MachineKey/MachineKeyFramework/MachineKeyFramework.csproj index 509371520..783085de3 100644 --- a/samples/MachineKey/MachineKeyFramework/MachineKeyFramework.csproj +++ b/samples/MachineKey/MachineKeyFramework/MachineKeyFramework.csproj @@ -2,12 +2,10 @@ net481 - - + - - + \ No newline at end of file diff --git a/samples/MachineKey/MachineKeyFramework/Web.config b/samples/MachineKey/MachineKeyFramework/Web.config index bef79a4de..2bcb73b52 100644 --- a/samples/MachineKey/MachineKeyFramework/Web.config +++ b/samples/MachineKey/MachineKeyFramework/Web.config @@ -18,4 +18,90 @@ --> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/RemoteAuth/Bearer/RemoteBearer/RemoteBearer.csproj b/samples/RemoteAuth/Bearer/RemoteBearer/RemoteBearer.csproj index 476dafcf4..3e07ceea9 100644 --- a/samples/RemoteAuth/Bearer/RemoteBearer/RemoteBearer.csproj +++ b/samples/RemoteAuth/Bearer/RemoteBearer/RemoteBearer.csproj @@ -2,41 +2,20 @@ net481 - - - 5.2.7 - - - 5.2.7 - - - 6.19.0 - - - 6.19.0 - - - 4.2.2 - - - 4.2.2 - - - 2.8.3 - - - 13.0.1 - - - 7.2.0 - - - 1.6.0 - + + + + + + + + + + - + \ No newline at end of file diff --git a/samples/RemoteAuth/Bearer/RemoteBearer/Web.config b/samples/RemoteAuth/Bearer/RemoteBearer/Web.config index d947cd35d..678b72b14 100644 --- a/samples/RemoteAuth/Bearer/RemoteBearer/Web.config +++ b/samples/RemoteAuth/Bearer/RemoteBearer/Web.config @@ -79,14 +79,38 @@ - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/RemoteAuth/Bearer/RemoteBearerCore/RemoteBearerCore.csproj b/samples/RemoteAuth/Bearer/RemoteBearerCore/RemoteBearerCore.csproj index 4687b5be5..960336eb9 100644 --- a/samples/RemoteAuth/Bearer/RemoteBearerCore/RemoteBearerCore.csproj +++ b/samples/RemoteAuth/Bearer/RemoteBearerCore/RemoteBearerCore.csproj @@ -4,11 +4,9 @@ enable enable - - + - diff --git a/samples/RemoteAuth/Forms/FormsAuth/FormsAuth.csproj b/samples/RemoteAuth/Forms/FormsAuth/FormsAuth.csproj index 4b1fc8cae..7cb0f706e 100644 --- a/samples/RemoteAuth/Forms/FormsAuth/FormsAuth.csproj +++ b/samples/RemoteAuth/Forms/FormsAuth/FormsAuth.csproj @@ -2,22 +2,21 @@ net481 - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -26,4 +25,4 @@ - + \ No newline at end of file diff --git a/samples/RemoteAuth/Forms/FormsAuth/Web.config b/samples/RemoteAuth/Forms/FormsAuth/Web.config index f0c563f2c..fb66e0aab 100644 --- a/samples/RemoteAuth/Forms/FormsAuth/Web.config +++ b/samples/RemoteAuth/Forms/FormsAuth/Web.config @@ -60,5 +60,23 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/RemoteAuth/Forms/FormsAuthCore/FormsAuthCore.csproj b/samples/RemoteAuth/Forms/FormsAuthCore/FormsAuthCore.csproj index 4cb53a64d..d6ac85b3c 100644 --- a/samples/RemoteAuth/Forms/FormsAuthCore/FormsAuthCore.csproj +++ b/samples/RemoteAuth/Forms/FormsAuthCore/FormsAuthCore.csproj @@ -4,11 +4,9 @@ enable enable - - + - diff --git a/samples/RemoteAuth/Identity/MvcApp/MvcApp.csproj b/samples/RemoteAuth/Identity/MvcApp/MvcApp.csproj index 7cec86436..659bfbfad 100644 --- a/samples/RemoteAuth/Identity/MvcApp/MvcApp.csproj +++ b/samples/RemoteAuth/Identity/MvcApp/MvcApp.csproj @@ -2,105 +2,48 @@ net481 - - - - 3.5.0.2 - - - - - - - - - - 2.2.3 - - - 2.2.4 - - - 5.2.7 - - - 1.1.3 - - - 5.2.7 - - - 6.0.7 - - - 6.0.7 - - - 3.1.32 - - - 2.1.1 - - - 6.0.0 - - - 6.0.0 - - - 6.0.1 - - - 6.0.0 - - - 3.2.11 - - - 4.2.2 - - - 4.2.2 - - - 2.1.38 - - - 4.2.2 - - - 2.0.1 - - - 5.0.0 - - - 13.0.1 - - - 5.0.0 - - - 4.3.0 - - - 6.0.0 - - - 6.0.0 - - - 1.6.0 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + \ No newline at end of file diff --git a/samples/RemoteAuth/Identity/MvcApp/Web.config b/samples/RemoteAuth/Identity/MvcApp/Web.config index 5e513403a..ce60f4cde 100644 --- a/samples/RemoteAuth/Identity/MvcApp/Web.config +++ b/samples/RemoteAuth/Identity/MvcApp/Web.config @@ -176,8 +176,8 @@ - - + + @@ -192,5 +192,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/RemoteAuth/Identity/MvcCoreApp/MvcCoreApp.csproj b/samples/RemoteAuth/Identity/MvcCoreApp/MvcCoreApp.csproj index 5b4a38bcc..a786f963e 100644 --- a/samples/RemoteAuth/Identity/MvcCoreApp/MvcCoreApp.csproj +++ b/samples/RemoteAuth/Identity/MvcCoreApp/MvcCoreApp.csproj @@ -4,11 +4,9 @@ enable enable - - + - diff --git a/samples/RemoteAuth/OIDC/OIDCAuth/OIDCAuth.csproj b/samples/RemoteAuth/OIDC/OIDCAuth/OIDCAuth.csproj index ef668cc54..1659a7791 100644 --- a/samples/RemoteAuth/OIDC/OIDCAuth/OIDCAuth.csproj +++ b/samples/RemoteAuth/OIDC/OIDCAuth/OIDCAuth.csproj @@ -2,55 +2,29 @@ net481 - - - - 3.5.0.2 - - - - - - - - - - 5.2.7 - - - 1.1.3 - - - 1.0.4.403061554 - - - 5.5.0 - - - 3.2.11 - - - 4.2.2 - - - 4.2.2 - - - 4.2.2 - - - 13.0.1 - - - 7.2.0 - - - 1.6.0 - + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/samples/RemoteAuth/OIDC/OIDCAuth/Web.config b/samples/RemoteAuth/OIDC/OIDCAuth/Web.config index 5203cc49a..1a903a011 100644 --- a/samples/RemoteAuth/OIDC/OIDCAuth/Web.config +++ b/samples/RemoteAuth/OIDC/OIDCAuth/Web.config @@ -50,14 +50,14 @@ - - + + - - + + @@ -92,14 +92,14 @@ - - + + - - + + @@ -108,5 +108,23 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/RemoteAuth/OIDC/OIDCAuthCore/OIDCAuthCore.csproj b/samples/RemoteAuth/OIDC/OIDCAuthCore/OIDCAuthCore.csproj index 4cb53a64d..d6ac85b3c 100644 --- a/samples/RemoteAuth/OIDC/OIDCAuthCore/OIDCAuthCore.csproj +++ b/samples/RemoteAuth/OIDC/OIDCAuthCore/OIDCAuthCore.csproj @@ -4,11 +4,9 @@ enable enable - - + - diff --git a/samples/RemoteSession/README.md b/samples/RemoteSession/README.md new file mode 100644 index 000000000..b808e3a37 --- /dev/null +++ b/samples/RemoteSession/README.md @@ -0,0 +1,9 @@ +# System.Web.Security.MachineKey Usage + +The adapters expose the `System.Web.Security.MachineKey` APIs to protect and unprotect data. On ASP.NET Framework, these unify with the in-box versions as usual. However, on ASP.NET Core framework, it uses the new [Data Protection APIs]. + +## ASP.NET Framework Apps + +In order to unprotect values from ASP.NET Core apps, .NET Framework apps must configure the app to [replace](https://learn.microsoft.com/aspnet/core/security/data-protection/compatibility/replacing-machinekey) the machine key implementations with data protection APIs. Once this is done, the ASP.NET Framework app will be using the same data protection APIs internally that ASP.NET Core is. + +> NOTE: This will cause the framework application to be unable to unencrypt values previously encrypted. If needed, these values must be migrated in some way to use the data protection APIs. This is out of scope for this project, but should be considered when configuring this. diff --git a/samples/RemoteSession/RemoteSessionCore/Program.cs b/samples/RemoteSession/RemoteSessionCore/Program.cs new file mode 100644 index 000000000..47ecbb4b5 --- /dev/null +++ b/samples/RemoteSession/RemoteSessionCore/Program.cs @@ -0,0 +1,47 @@ +using Microsoft.AspNetCore.Http.Features; +using Microsoft.AspNetCore.SystemWebAdapters; +using Microsoft.AspNetCore.SystemWebAdapters.Features; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddReverseProxy(); + +builder.Services.AddSystemWebAdapters() + .AddSessionSerializer(options => + { + options.ThrowOnUnknownSessionKey = false; + }) + .AddJsonSessionSerializer(options => + { + options.RegisterKey("CoreCount"); + }) + .AddRemoteAppClient(options => + { + options.ApiKey = builder.Configuration["RemoteApp:Key"]!; + options.RemoteAppUrl = new(builder.Configuration["RemoteApp:Url"]); + }) + .AddSessionClient(); + +var app = builder.Build(); + +app.UseSystemWebAdapters(); + +app.Map("/", (HttpContext context) => +{ + var session = context.AsSystemWeb().Session!; + + if (session["CoreCount"] is int count) + { + session["CoreCount"] = count + 1; + } + else + { + session["CoreCount"] = 0; + } + + return session.Cast().Select(key => new { Key = key, Value = session[key] }); +}).RequireSystemWebAdapterSession(); + +app.MapForwarder("/{**catch-all}", builder.Configuration["RemoteApp:Url"]!).WithOrder(int.MaxValue); + +app.Run(); diff --git a/samples/RemoteSession/RemoteSessionCore/Properties/launchSettings.json b/samples/RemoteSession/RemoteSessionCore/Properties/launchSettings.json new file mode 100644 index 000000000..dfae028ab --- /dev/null +++ b/samples/RemoteSession/RemoteSessionCore/Properties/launchSettings.json @@ -0,0 +1,37 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:71942", + "sslPort": 44371 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:7204", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7146;http://localhost:5204", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/samples/RemoteSession/RemoteSessionCore/RemoteSessionCore.csproj b/samples/RemoteSession/RemoteSessionCore/RemoteSessionCore.csproj new file mode 100644 index 000000000..ab779ec97 --- /dev/null +++ b/samples/RemoteSession/RemoteSessionCore/RemoteSessionCore.csproj @@ -0,0 +1,14 @@ + + + net8.0 + enable + enable + 0470f8a1-dd59-4e2c-a7e2-71c91e1a46d8 + + + + + + + + \ No newline at end of file diff --git a/samples/RemoteSession/RemoteSessionCore/appsettings.Development.json b/samples/RemoteSession/RemoteSessionCore/appsettings.Development.json new file mode 100644 index 000000000..770d3e931 --- /dev/null +++ b/samples/RemoteSession/RemoteSessionCore/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/samples/RemoteSession/RemoteSessionCore/appsettings.json b/samples/RemoteSession/RemoteSessionCore/appsettings.json new file mode 100644 index 000000000..406d5fe1d --- /dev/null +++ b/samples/RemoteSession/RemoteSessionCore/appsettings.json @@ -0,0 +1,14 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "RemoteApp": { + "Key": "23EB1AEF-E019-4850-A257-3DB3A85495BD", + "Url": "https://localhost:44305" + } + +} diff --git a/samples/RemoteSession/RemoteSessionCore/wwwroot/favicon.ico b/samples/RemoteSession/RemoteSessionCore/wwwroot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..63e859b476eff5055e0e557aaa151ca8223fbeef GIT binary patch literal 5430 zcmc&&Yj2xp8Fqnv;>&(QB_ve7>^E#o2mu=cO~A%R>DU-_hfbSRv1t;m7zJ_AMrntN zy0+^f&8be>q&YYzH%(88lQ?#KwiCzaCO*ZEo%j&v;<}&Lj_stKTKK>#U3nin@AF>w zb3ONSAFR{u(S1d?cdw53y}Gt1b-Hirbh;;bm(Rcbnoc*%@jiaXM|4jU^1WO~`TYZ~ zC-~jh9~b-f?fX`DmwvcguQzn*uV}c^Vd&~?H|RUs4Epv~gTAfR(B0lT&?RWQOtduM z^1vUD9{HQsW!{a9|0crA34m7Z6lpG^}f6f?={zD+ zXAzk^i^aKN_}s2$eX81wjSMONE#WVdzf|MT)Ap*}Vsn!XbvsI#6o&ij{87^d%$|A{ z=F{KB%)g%@z76yBzbb7seW**Ju8r4e*Z3PWNX3_tTDgzZatz7)Q6ytwB%@&@A|XT; zecM`Snxx5po$C)%yCP!KEtos~eOS)@2=kX-RIm)4glMCoagTEFxrBeSX%Euz734Fk z%7)x(k~T!@Hbg_37NSQL!vlTBXoURSzt~I**Zw`&F24fH*&kx=%nvZv|49SC*daD( zIw<~%#=lk8{2-l(BcIjy^Q$Q&m#KlWL9?UG{b8@qhlD z;umc+6p%|NsAT~0@DgV4-NKgQuWPWrmPIK&&XhV&n%`{l zOl^bbWYjQNuVXTXESO)@|iUKVmErPUDfz2Wh`4dF@OFiaCW|d`3paV^@|r^8T_ZxM)Z+$p5qx# z#K=z@%;aBPO=C4JNNGqVv6@UGolIz;KZsAro``Rz8X%vq_gpi^qEV&evgHb_=Y9-l z`)imdx0UC>GWZYj)3+3aKh?zVb}=@%oNzg7a8%kfVl)SV-Amp1Okw&+hEZ3|v(k8vRjXW9?ih`&FFM zV$~{j3IzhtcXk?Mu_!12;=+I7XK-IR2>Yd%VB^?oI9c^E&Chb&&je$NV0P-R;ujkP z;cbLCCPEF6|22NDj=S`F^2e~XwT1ZnRX8ra0#DaFa9-X|8(xNW_+JhD75WnSd7cxo z2>I_J5{c|WPfrgl7E2R)^c}F7ry()Z>$Jhk9CzZxiPKL#_0%`&{MX>P_%b~Dx0D^S z7xP1(DQ!d_Icpk!RN3I1w@~|O1ru#CO==h#9M~S4Chx*@?=EKUPGBv$tmU+7Zs_al z`!jR?6T&Z7(%uVq>#yLu`abWk!FBlnY{RFNHlj~6zh*;@u}+}viRKsD`IIxN#R-X3 z@vxu#EA_m}I503U(8Qmx^}u;)KfGP`O9E1H1Q|xeeksX8jC%@!{YT1)!lWgO=+Y3*jr=iSxvOW1}^HSy=y){tOMQJ@an>sOl4FYniE z;GOxd7AqxZNbYFNqobpv&HVO$c-w!Y*6r;$2oJ~h(a#(Bp<-)dg*mNigX~9rPqcHv z^;c*|Md?tD)$y?6FO$DWl$jUGV`F1G_^E&E>sY*YnA~ruv3=z9F8&&~Xpm<<75?N3 z>x~`I&M9q)O1=zWZHN9hZWx>RQ}zLP+iL57Q)%&_^$Sme^^G7;e-P~CR?kqU#Io#( z(nH1Wn*Ig)|M>WLGrxoU?FZrS`4GO&w;+39A3f8w{{Q7eg|$+dIlNFPAe+tN=FOYU z{A&Fg|H73+w1IK(W=j*L>JQgz$g0 z7JpKXLHIh}#$wm|N`s}o-@|L_`>*(gTQ~)wr3Eap7g%PVNisKw82im;Gdv#85x#s+ zoqqtnwu4ycd>cOQgRh-=aEJbnvVK`}ja%+FZx}&ehtX)n(9nVfe4{mn0bgijUbNr7Tf5X^$*{qh2%`?--%+sbSrjE^;1e3>% zqa%jdY16{Y)a1hSy*mr0JGU05Z%=qlx5vGvTjSpTt6k%nR06q}1DU`SQh_ZAeJ}A@`hL~xvv05U?0%=spP`R>dk?cOWM9^KNb7B?xjex>OZo%JMQQ1Q zB|q@}8RiP@DWn-(fB;phPaIOP2Yp)XN3-Fsn)S3w($4&+p8f5W_f%gac}QvmkHfCj$2=!t`boCvQ zCW;&Dto=f8v##}dy^wg3VNaBy&kCe3N;1|@n@pUaMPT?(aJ9b*(gJ28$}(2qFt$H~u5z94xcIQkcOI++)*exzbrk?WOOOf*|%k5#KV zL=&ky3)Eirv$wbRJ2F2s_ILQY--D~~7>^f}W|Aw^e7inXr#WLI{@h`0|jHud2Y~cI~Yn{r_kU^Vo{1gja diff --git a/samples/RemoteSession/RemoteSessionFramework/Global.asax.cs b/samples/RemoteSession/RemoteSessionFramework/Global.asax.cs new file mode 100644 index 000000000..7f997ec1d --- /dev/null +++ b/samples/RemoteSession/RemoteSessionFramework/Global.asax.cs @@ -0,0 +1,42 @@ +using System; +using System.Configuration; +using System.Web; +using System.Web.Routing; + +namespace RemoteSessionFramework +{ + public class SessionApplication : HttpApplication + { + protected void Application_Start() + { + SystemWebAdapterConfiguration.AddSystemWebAdapters(this) + .AddProxySupport(options => options.UseForwardedHeaders = true) + .AddSessionSerializer(options => + { + }) + .AddJsonSessionSerializer(options => + { + options.RegisterKey("CoreCount"); + }) + .AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) + .AddSessionServer(options => + { + }); + } + + protected void Application_PostAcquireRequestState(object sender, EventArgs e) + { + if (((HttpApplication)sender).Context.Session is { } session) + { + if (session["FrameworkCount"] is int count) + { + session["FrameworkCount"] = count + 1; + } + else + { + session["FrameworkCount"] = 0; + } + } + } + } +} diff --git a/samples/RemoteSession/RemoteSessionFramework/Properties/launchSettings.json b/samples/RemoteSession/RemoteSessionFramework/Properties/launchSettings.json new file mode 100644 index 000000000..bbd9e7e9f --- /dev/null +++ b/samples/RemoteSession/RemoteSessionFramework/Properties/launchSettings.json @@ -0,0 +1,17 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + + "iisExpress": { + "sslPort": 44305, + "applicationUrl": "http://localhost:47554" + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": false + } + } +} diff --git a/samples/RemoteSession/RemoteSessionFramework/RemoteSessionFramework.csproj b/samples/RemoteSession/RemoteSessionFramework/RemoteSessionFramework.csproj new file mode 100644 index 000000000..29a56404a --- /dev/null +++ b/samples/RemoteSession/RemoteSessionFramework/RemoteSessionFramework.csproj @@ -0,0 +1,13 @@ + + + net481 + + + + + + + + + + diff --git a/samples/RemoteSession/RemoteSessionFramework/SessionInfo.cs b/samples/RemoteSession/RemoteSessionFramework/SessionInfo.cs new file mode 100644 index 000000000..dc723889d --- /dev/null +++ b/samples/RemoteSession/RemoteSessionFramework/SessionInfo.cs @@ -0,0 +1,23 @@ +using System; +using System.Linq; +using System.Text.Json; +using System.Web; +using System.Web.SessionState; +using static System.Collections.Specialized.BitVector32; + +namespace RemoteSessionFramework; + +public class SessionInfo : IHttpHandler, IRequiresSessionState +{ + public bool IsReusable => true; + + public void ProcessRequest(HttpContext context) + { + context.Response.ContentType = "application/json"; + context.Response.StatusCode = 200; + + var data = context.Session.Keys.Cast().Select(key => new { Key = key, Value = context.Session[key] }); + + context.Response.Write(JsonSerializer.Serialize(data)); + } +} diff --git a/samples/RemoteSession/RemoteSessionFramework/Web.Debug.config b/samples/RemoteSession/RemoteSessionFramework/Web.Debug.config new file mode 100644 index 000000000..fae9cfefa --- /dev/null +++ b/samples/RemoteSession/RemoteSessionFramework/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/samples/RemoteSession/RemoteSessionFramework/Web.Release.config b/samples/RemoteSession/RemoteSessionFramework/Web.Release.config new file mode 100644 index 000000000..da6e960b8 --- /dev/null +++ b/samples/RemoteSession/RemoteSessionFramework/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/samples/RemoteSession/RemoteSessionFramework/Web.config b/samples/RemoteSession/RemoteSessionFramework/Web.config new file mode 100644 index 000000000..b4ad8b623 --- /dev/null +++ b/samples/RemoteSession/RemoteSessionFramework/Web.config @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/WebFormsToBlazor/BlazorCore/BlazorCore.csproj b/samples/WebFormsToBlazor/BlazorCore/BlazorCore.csproj index dca885037..a4eb57fb4 100644 --- a/samples/WebFormsToBlazor/BlazorCore/BlazorCore.csproj +++ b/samples/WebFormsToBlazor/BlazorCore/BlazorCore.csproj @@ -1,18 +1,17 @@ - net8.0 enable enable - - - + + + + + - - - + \ No newline at end of file diff --git a/samples/WebFormsToBlazor/BlazorCore/Program.cs b/samples/WebFormsToBlazor/BlazorCore/Program.cs index 7187ed980..a76d77c48 100644 --- a/samples/WebFormsToBlazor/BlazorCore/Program.cs +++ b/samples/WebFormsToBlazor/BlazorCore/Program.cs @@ -18,7 +18,7 @@ .AddRemoteAppClient(options => { options.RemoteAppUrl = new(builder.Configuration["ProxyTo"]); - options.ApiKey = builder.Configuration["RemoteAppApiKey"]; + options.ApiKey = builder.Configuration["RemoteAppApiKey"]!; }) .AddSessionClient(); @@ -43,7 +43,7 @@ * TLDR: We need to ensure that SystemWeb.Adapters is not used with Blazor SignalR */ app.UseWhen( - (context) => HttpMethods.IsConnect(context.Request.Method) == false, + (context) => !HttpMethods.IsConnect(context.Request.Method), appBuilder => appBuilder.UseSystemWebAdapters()); //app.UseWhen( // (context) => context.Request.Path.ToString().Contains("/_blazor", StringComparison.OrdinalIgnoreCase) == false, diff --git a/samples/WebFormsToBlazor/WebFormsFramework/Web.config b/samples/WebFormsToBlazor/WebFormsFramework/Web.config index fd8933a3f..b7907ba4f 100644 --- a/samples/WebFormsToBlazor/WebFormsFramework/Web.config +++ b/samples/WebFormsToBlazor/WebFormsFramework/Web.config @@ -6,7 +6,7 @@ - + @@ -63,5 +63,23 @@ + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/samples/WebFormsToBlazor/WebFormsFramework/WebFormsFramework.csproj b/samples/WebFormsToBlazor/WebFormsFramework/WebFormsFramework.csproj index b33a877ba..a621e45c3 100644 --- a/samples/WebFormsToBlazor/WebFormsFramework/WebFormsFramework.csproj +++ b/samples/WebFormsToBlazor/WebFormsFramework/WebFormsFramework.csproj @@ -2,46 +2,23 @@ net481 - - - 3.5.0.2 - - - 3.7.1 - - - 1.0.2 - - - 5.0.0 - - - 5.0.0 - - - 1.1.3 - - - 2.0.1 - - - 2.8.3 - - - 13.0.1 - - - 1.6.0 - + + + + + + + + + + - - - + \ No newline at end of file diff --git a/samples/WindowsAuth/WindowsAuth.csproj b/samples/WindowsAuth/WindowsAuth.csproj index bb23f8dde..404758f1b 100644 --- a/samples/WindowsAuth/WindowsAuth.csproj +++ b/samples/WindowsAuth/WindowsAuth.csproj @@ -1,19 +1,17 @@ - net8.0 enable enable - - - + + + + - - - + \ No newline at end of file