diff --git a/docs/core.md b/docs/core.md index 0256824e50..3853e52107 100644 --- a/docs/core.md +++ b/docs/core.md @@ -11,13 +11,12 @@ var builder = WebApplication.CreateBuilder(); builder.Services.AddControllersWithViews(); builder.Services.AddSystemWebAdapters() .AddJsonSessionKeySerializer(options => ClassLibrary.SessionUtils.RegisterSessionKeys(options)) - .AddRemoteAppClient(remote => remote - .Configure(options => - { - options.RemoteApp = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); - options.ApiKey = ClassLibrary.SessionUtils.ApiKey; - }) - .AddSession()); + .AddRemoteAppClient(options => + { + options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); + options.ApiKey = builder.Configuration("RemoteAppApiKey"); + }) + .AddSessionClient(); var app = builder.Build(); diff --git a/docs/framework.md b/docs/framework.md index 80c7d524a6..118ea5aead 100644 --- a/docs/framework.md +++ b/docs/framework.md @@ -29,9 +29,8 @@ protected void Application_Start() SystemWebAdapterConfiguration.AddSystemWebAdapters(this) .AddProxySupport(options => options.UseForwardedHeaders = true) .AddJsonSessionSerializer(options => ClassLibrary.SessionUtils.RegisterSessionKeys(options.KnownKeys)) - .AddRemoteAppServer(remote => remote - .Configure(options => options.ApiKey = ClassLibrary.SessionUtils.ApiKey) - .AddSession()); + .AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) + .AddSessionServer(); } ``` diff --git a/docs/remote-app-setup.md b/docs/remote-app-setup.md index b880e36947..1fe40f6978 100644 --- a/docs/remote-app-setup.md +++ b/docs/remote-app-setup.md @@ -14,10 +14,10 @@ To setup the ASP.NET app to be able to receive requests from the ASP.NET Core ap ```CSharp SystemWebAdapterConfiguration.AddSystemWebAdapters(this) - .AddRemoteApp(options => + .AddRemoteAppServer(options => { // ApiKey is a string representing a GUID - options.ApiKey = "00000000-0000-0000-0000-000000000000"; + options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]; }); ``` @@ -29,12 +29,10 @@ To setup the ASP.NET Core app to be able to send requests to the ASP.NET app, yo ```CSharp builder.Services.AddSystemWebAdapters() - .AddRemoteApp(options => + .AddRemoteAppClient(options => { - options.RemoteAppUrl = new(builder.Configuration["http://URL-for-the-ASPNet-app"]); - - // ApiKey is a string representing a GUID - options.ApiKey = "00000000-0000-0000-0000-000000000000"; + options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); + options.ApiKey = builder.Configuration("RemoteAppApiKey"); }); ``` diff --git a/docs/remote-authentication/remote-authentication.md b/docs/remote-authentication/remote-authentication.md index 65f7f5384c..49c2a82c92 100644 --- a/docs/remote-authentication/remote-authentication.md +++ b/docs/remote-authentication/remote-authentication.md @@ -17,8 +17,7 @@ SystemWebAdapterConfiguration.AddSystemWebAdapters(this) .AddProxySupport(options => options.UseForwardedHeaders = true) .AddRemoteApp(options => { - // ApiKey is a string representing a GUID - options.ApiKey = "00000000-0000-0000-0000-000000000000"; + options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]; }) .AddRemoteAppAuthentication(); ``` @@ -31,10 +30,8 @@ Next, the ASP.NET Core app needs to be configured to enable the authentication h builder.Services.AddSystemWebAdapters() .AddRemoteApp(options => { - options.RemoteAppUrl = new(builder.Configuration["http://URL-for-the-ASPNet-app"]); - - // ApiKey is a string representing a GUID - options.ApiKey = "00000000-0000-0000-0000-000000000000"; + options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); + options.ApiKey = builder.Configuration("RemoteAppApiKey"); }) .AddRemoteAppAuthentication(true); ``` diff --git a/docs/session-state/remote-session.md b/docs/session-state/remote-session.md index da36977ac7..19aebbc2f2 100644 --- a/docs/session-state/remote-session.md +++ b/docs/session-state/remote-session.md @@ -22,22 +22,21 @@ Configuration for ASP.NET Core involves calling `AddRemoteAppSession` and `AddJs ```csharp builder.Services.AddSystemWebAdapters() - .AddRemoteApp(options => + .AddJsonSessionSerializer(options => + { + // Serialization/deserialization requires each session key to be registered to a type + options.RegisterKey("test-value"); + options.RegisterKey("SampleSessionItem"); + }) + .AddRemoteAppClient(options => { // Provide the URL for the remote app that has enabled session querying options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); // Provide a strong API key that will be used to authenticate the request on the remote app for querying the session - // ApiKey is a string representing a GUID - options.ApiKey = "00000000-0000-0000-0000-000000000000"; + options.ApiKey = builder.Configuration("RemoteAppApiKey"); }) - .AddRemoteAppSession() - .AddJsonSessionSerializer(options => - { - // Serialization/deserialization requires each session key to be registered to a type - options.RegisterKey("test-value"); - options.RegisterKey("SampleSessionItem"); - }); + .AddSessionClient(); ``` Session support requires additional work for the ASP.NET Core pipeline, and is not turned on by default. It can be configured on a per-route basis via ASP.NET Core metadata. @@ -62,16 +61,16 @@ The framework equivalent would look like the following change in `Global.asax.cs ```csharp SystemWebAdapterConfiguration.AddSystemWebAdapters(this) - // Provide a strong API key that will be used to authenticate the request on the remote app for querying the session - // ApiKey is a string representing a GUID - .AddRemoteApp(options => options.ApiKey = "00000000-0000-0000-0000-000000000000") - .AddRemoteAppSession() .AddJsonSessionSerializer(options => { // Serialization/deserialization requires each session key to be registered to a type options.RegisterKey("test-value"); options.RegisterKey("SampleSessionItem"); - }); + }) + // Provide a strong API key that will be used to authenticate the request on the remote app for querying the session + // ApiKey is a string representing a GUID + .AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) + .AddSessionServer(); ``` # Protocol diff --git a/samples/MvcApp/Global.asax.cs b/samples/MvcApp/Global.asax.cs index 3e7edae6c3..f4be9aa854 100644 --- a/samples/MvcApp/Global.asax.cs +++ b/samples/MvcApp/Global.asax.cs @@ -20,10 +20,9 @@ protected void Application_Start() SystemWebAdapterConfiguration.AddSystemWebAdapters(this) .AddProxySupport(options => options.UseForwardedHeaders = true) .AddJsonSessionSerializer(options => ClassLibrary.RemoteServiceUtils.RegisterSessionKeys(options.KnownKeys)) - .AddRemoteAppServer(remote => remote - .Configure(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) - .AddAuthentication() - .AddSession()); + .AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) + .AddAuthenticationServer() + .AddSessionServer(); } } } diff --git a/samples/MvcCoreApp/Program.cs b/samples/MvcCoreApp/Program.cs index 5b02e07f5e..9cccd60832 100644 --- a/samples/MvcCoreApp/Program.cs +++ b/samples/MvcCoreApp/Program.cs @@ -17,15 +17,14 @@ // Add services to the container. builder.Services.AddControllersWithViews(); builder.Services.AddSystemWebAdapters() - .AddRemoteAppClient(remote => remote - .Configure(options => - { - options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); - options.ApiKey = builder.Configuration["RemoteAppApiKey"]; - }) - .AddAuthentication(true) - .AddSession()) - .AddJsonSessionSerializer(options => ClassLibrary.RemoteServiceUtils.RegisterSessionKeys(options.KnownKeys)); + .AddJsonSessionSerializer(options => ClassLibrary.RemoteServiceUtils.RegisterSessionKeys(options.KnownKeys)) + .AddRemoteAppClient(options => + { + options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); + options.ApiKey = builder.Configuration["RemoteAppApiKey"]; + }) + .AddAuthenticationClient(true) + .AddSessionClient(); var app = builder.Build(); diff --git a/samples/RemoteAuth/Bearer/RemoteBearer/Global.asax.cs b/samples/RemoteAuth/Bearer/RemoteBearer/Global.asax.cs index 9d1056a945..21658f3965 100644 --- a/samples/RemoteAuth/Bearer/RemoteBearer/Global.asax.cs +++ b/samples/RemoteAuth/Bearer/RemoteBearer/Global.asax.cs @@ -13,14 +13,8 @@ protected void Application_Start() FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); SystemWebAdapterConfiguration.AddSystemWebAdapters(this) - .AddRemoteAppServer(remote => remote - .Configure(options => - { - // A real application would not hard code this, but load it - // securely from environment or configuration - options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]; - }) - .AddAuthentication()); + .AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) + .AddAuthenticationServer(); } } } diff --git a/samples/RemoteAuth/Bearer/RemoteBearerCore/Program.cs b/samples/RemoteAuth/Bearer/RemoteBearerCore/Program.cs index 54fa37d44e..5c28ed90a5 100644 --- a/samples/RemoteAuth/Bearer/RemoteBearerCore/Program.cs +++ b/samples/RemoteAuth/Bearer/RemoteBearerCore/Program.cs @@ -6,18 +6,17 @@ builder.Services.AddControllers(); builder.Services.AddSystemWebAdapters() - .AddRemoteAppClient(remote => remote - .Configure(options => - { - options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); - options.ApiKey = builder.Configuration["RemoteAppApiKey"]; - }) - - // This registers the remote app authentication handler. The boolean argument indicates whether remote app auth - // should be the default scheme. If it is set to false, HTTP requests to authenticate will only be made for - // endpoints that actually need that behavior, but it is then necessary to annotate endpoints requiring remote app - // auth with [Authorize(AuthenticationSchemes = RemoteAppAuthenticationDefaults.AuthenticationScheme)] or something similar. - .AddAuthentication(isDefaultScheme: true)); + .AddRemoteAppClient(options => + { + options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); + options.ApiKey = builder.Configuration["RemoteAppApiKey"]; + }) + + // This registers the remote app authentication handler. The boolean argument indicates whether remote app auth + // should be the default scheme. If it is set to false, HTTP requests to authenticate will only be made for + // endpoints that actually need that behavior, but it is then necessary to annotate endpoints requiring remote app + // auth with [Authorize(AuthenticationSchemes = RemoteAppAuthenticationDefaults.AuthenticationScheme)] or something similar. + .AddAuthenticationClient(isDefaultScheme: true); var app = builder.Build(); diff --git a/samples/RemoteAuth/Forms/FormsAuth/Global.asax.cs b/samples/RemoteAuth/Forms/FormsAuth/Global.asax.cs index 15a4ec9662..39e5086cf8 100644 --- a/samples/RemoteAuth/Forms/FormsAuth/Global.asax.cs +++ b/samples/RemoteAuth/Forms/FormsAuth/Global.asax.cs @@ -17,12 +17,11 @@ void Application_Start(object sender, EventArgs e) SystemWebAdapterConfiguration.AddSystemWebAdapters(this) .AddProxySupport(options => options.UseForwardedHeaders = true) - .AddRemoteAppServer(remote => remote - .Configure(options => + .AddRemoteAppServer(options => { options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]; }) - .AddAuthentication()); + .AddAuthenticationServer(); } } } diff --git a/samples/RemoteAuth/Forms/FormsAuthCore/Program.cs b/samples/RemoteAuth/Forms/FormsAuthCore/Program.cs index 034790dc19..3efa702045 100644 --- a/samples/RemoteAuth/Forms/FormsAuthCore/Program.cs +++ b/samples/RemoteAuth/Forms/FormsAuthCore/Program.cs @@ -7,13 +7,12 @@ // Add System.Web adapter services, including registering remote app authentication builder.Services.AddSystemWebAdapters() - .AddRemoteAppClient(remote => remote - .Configure(options => - { - options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); - options.ApiKey = builder.Configuration["RemoteAppApiKey"]; - }) - .AddAuthentication(true)); + .AddRemoteAppClient(options => + { + options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); + options.ApiKey = builder.Configuration["RemoteAppApiKey"]; + }) + .AddAuthenticationClient(true); var app = builder.Build(); diff --git a/samples/RemoteAuth/OIDC/OIDCAuth/Global.asax.cs b/samples/RemoteAuth/OIDC/OIDCAuth/Global.asax.cs index 8355e0aaea..aa904614d7 100644 --- a/samples/RemoteAuth/OIDC/OIDCAuth/Global.asax.cs +++ b/samples/RemoteAuth/OIDC/OIDCAuth/Global.asax.cs @@ -17,9 +17,8 @@ protected void Application_Start() SystemWebAdapterConfiguration.AddSystemWebAdapters(this) .AddProxySupport(options => options.UseForwardedHeaders = true) - .AddRemoteAppServer(remote => remote - .Configure(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) - .AddAuthentication()); + .AddRemoteAppServer(options => options.ApiKey = ConfigurationManager.AppSettings["RemoteAppApiKey"]) + .AddAuthenticationServer(); } } diff --git a/samples/RemoteAuth/OIDC/OIDCAuthCore/Program.cs b/samples/RemoteAuth/OIDC/OIDCAuthCore/Program.cs index 3d1df77ad4..bc450677d7 100644 --- a/samples/RemoteAuth/OIDC/OIDCAuthCore/Program.cs +++ b/samples/RemoteAuth/OIDC/OIDCAuthCore/Program.cs @@ -1,13 +1,12 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddSystemWebAdapters() - .AddRemoteAppClient(remote => remote - .Configure(options => - { - options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); - options.ApiKey = builder.Configuration["RemoteAppApiKey"]; - }) - .AddAuthentication(true)); + .AddRemoteAppClient(options => + { + options.RemoteAppUrl = new(builder.Configuration["ReverseProxy:Clusters:fallbackCluster:Destinations:fallbackApp:Address"]); + options.ApiKey = builder.Configuration["RemoteAppApiKey"]; + }) + .AddAuthenticationClient(true); builder.Services.AddReverseProxy().LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/Authentication/RemoteAppAuthenticationExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/Authentication/RemoteAppAuthenticationExtensions.cs index 7f43daf6d4..5faf3d5c3d 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/Authentication/RemoteAppAuthenticationExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/Authentication/RemoteAppAuthenticationExtensions.cs @@ -69,7 +69,7 @@ public static AuthenticationBuilder AddRemoteAppAuthentication(this Authenticati /// /// Specifies whether the remote authentication scheme should be the default authentication scheme. If false, remote authentication will only be used for endpoints specifically requiring the remote authentication scheme. /// Configuration options for the remote authentication handler. - public static ISystemWebAdapterRemoteClientAppBuilder AddAuthentication(this ISystemWebAdapterRemoteClientAppBuilder builder, bool isDefaultScheme, Action? configureOptions = null) + public static ISystemWebAdapterRemoteClientAppBuilder AddAuthenticationClient(this ISystemWebAdapterRemoteClientAppBuilder builder, bool isDefaultScheme, Action? configureOptions = null) { if (builder is null) { diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/RemoteAppClientExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/RemoteAppClientExtensions.cs index be325f9d69..2a3812868f 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/RemoteAppClientExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/RemoteAppClientExtensions.cs @@ -14,7 +14,7 @@ public static class RemoteAppClientExtensions /// Add configuration for connecting to a remote app for System.Web extensions that require a remote /// ASP.NET app such as remote app authentication or remote app session sharing. /// - public static ISystemWebAdapterBuilder AddRemoteAppClient(this ISystemWebAdapterBuilder builder, Action configure) + public static ISystemWebAdapterRemoteClientAppBuilder AddRemoteAppClient(this ISystemWebAdapterBuilder builder, Action configure) { if (builder is null) { @@ -27,6 +27,7 @@ public static ISystemWebAdapterBuilder AddRemoteAppClient(this ISystemWebAdapter } builder.Services.AddOptions() + .Configure(configure) .ValidateDataAnnotations(); builder.Services.AddHttpClient(RemoteConstants.HttpClientName) @@ -50,27 +51,7 @@ public static ISystemWebAdapterBuilder AddRemoteAppClient(this ISystemWebAdapter client.DefaultRequestHeaders.Add(options.ApiKeyHeader, options.ApiKey); }); - configure(new Builder(builder.Services)); - - return builder; - } - - public static ISystemWebAdapterRemoteClientAppBuilder Configure(this ISystemWebAdapterRemoteClientAppBuilder builder, Action configure) - { - if (builder is null) - { - throw new ArgumentNullException(nameof(builder)); - } - - if (configure is null) - { - throw new ArgumentNullException(nameof(configure)); - } - - builder.Services.AddOptions() - .Configure(configure); - - return builder; + return new Builder(builder.Services); } private class Builder : ISystemWebAdapterRemoteClientAppBuilder diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs index 9bb2fce110..c31c9b7a75 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.CoreServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs @@ -9,7 +9,7 @@ namespace Microsoft.Extensions.DependencyInjection; public static class RemoteAppSessionStateExtensions { - public static ISystemWebAdapterRemoteClientAppBuilder AddSession(this ISystemWebAdapterRemoteClientAppBuilder builder, Action? configure = null) + public static ISystemWebAdapterRemoteClientAppBuilder AddSessionClient(this ISystemWebAdapterRemoteClientAppBuilder builder, Action? configure = null) { if (builder is null) { diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/Authentication/RemoteAppAuthenticationExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/Authentication/RemoteAppAuthenticationExtensions.cs index c8976e524a..5d485865b7 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/Authentication/RemoteAppAuthenticationExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/Authentication/RemoteAppAuthenticationExtensions.cs @@ -18,7 +18,7 @@ public static class RemoteAppAuthenticationExtensions /// The System.Web adapter builder to modify. /// Configuration to use when registering the remote authentication module. /// The System.Web adapter builder updated to include the remote authentication module. - public static ISystemWebAdapterRemoteServerAppBuilder AddAuthentication(this ISystemWebAdapterRemoteServerAppBuilder builder, Action? configure = null) + public static ISystemWebAdapterRemoteServerAppBuilder AddAuthenticationServer(this ISystemWebAdapterRemoteServerAppBuilder builder, Action? configure = null) { if (builder is null) { diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/RemoteAppServerExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/RemoteAppServerExtensions.cs index 0b6bdc7b66..6b7df2de6e 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/RemoteAppServerExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/RemoteAppServerExtensions.cs @@ -12,7 +12,7 @@ public static class RemoteAppServerExtensions /// Add configuration for connecting to a remote app for System.Web extensions that require a remote /// ASP.NET app such as remote app authentication or remote app session sharing. /// - public static ISystemWebAdapterBuilder AddRemoteAppServer(this ISystemWebAdapterBuilder builder, Action configure) + public static ISystemWebAdapterRemoteServerAppBuilder AddRemoteAppServer(this ISystemWebAdapterBuilder builder, Action configure) { if (builder is null) { @@ -25,29 +25,10 @@ public static ISystemWebAdapterBuilder AddRemoteAppServer(this ISystemWebAdapter } builder.Services.AddOptions() + .Configure(configure) .ValidateDataAnnotations(); - configure(new Builder(builder.Services)); - - return builder; - } - - public static ISystemWebAdapterRemoteServerAppBuilder Configure(this ISystemWebAdapterRemoteServerAppBuilder builder, Action configure) - { - if (builder is null) - { - throw new ArgumentNullException(nameof(builder)); - } - - if (configure is null) - { - throw new ArgumentNullException(nameof(configure)); - } - - builder.Services.AddOptions() - .Configure(configure); - - return builder; + return new Builder(builder.Services); } private class Builder : ISystemWebAdapterRemoteServerAppBuilder diff --git a/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs b/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs index ad9543d8fb..fca61c08d8 100644 --- a/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs +++ b/src/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices/SessionState/RemoteSession/RemoteAppSessionStateExtensions.cs @@ -10,7 +10,7 @@ namespace System.Web; public static class RemoteAppSessionStateExtensions { - public static ISystemWebAdapterRemoteServerAppBuilder AddSession(this ISystemWebAdapterRemoteServerAppBuilder builder, Action? configureRemote = null) + public static ISystemWebAdapterRemoteServerAppBuilder AddSessionServer(this ISystemWebAdapterRemoteServerAppBuilder builder, Action? configureRemote = null) { if (builder is null) { diff --git a/test/Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests/RemoteAppClientOptionsTests.cs b/test/Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests/RemoteAppClientOptionsTests.cs index c6f8771019..4466bdcfb3 100644 --- a/test/Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests/RemoteAppClientOptionsTests.cs +++ b/test/Microsoft.AspNetCore.SystemWebAdapters.CoreServices.Tests/RemoteAppClientOptionsTests.cs @@ -30,17 +30,16 @@ public void VerifyIsCalled(string apiKeyHeader, string apiKey, string remoteAppU var services = new ServiceCollection(); var builder = new TestBuilder { Services = services }; - builder.AddRemoteAppClient(remote => remote - .Configure(options => - { - options.ApiKey = apiKey; - options.ApiKeyHeader = apiKeyHeader; + builder.AddRemoteAppClient(options => + { + options.ApiKey = apiKey; + options.ApiKeyHeader = apiKeyHeader; - if (remoteAppUrl is not null) - { - options.RemoteAppUrl = new Uri(remoteAppUrl, UriKind.Absolute); - } - })); + if (remoteAppUrl is not null) + { + options.RemoteAppUrl = new Uri(remoteAppUrl, UriKind.Absolute); + } + }); using var serviceProvider = services.BuildServiceProvider(); diff --git a/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/Authentication/RemoteAppAuthenticationServerOptionsTests.cs b/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/Authentication/RemoteAppAuthenticationServerOptionsTests.cs index c647f038ed..7e5668114e 100644 --- a/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/Authentication/RemoteAppAuthenticationServerOptionsTests.cs +++ b/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/Authentication/RemoteAppAuthenticationServerOptionsTests.cs @@ -21,7 +21,7 @@ public void VerifyIsCalled(string endpoint, bool shouldSucceed) var services = new ServiceCollection(); var builder = new TestBuilder { Services = services }; - builder.AddAuthentication(options => + builder.AddAuthenticationServer(options => { options.AuthenticationEndpointPath = endpoint; }); diff --git a/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/RemoteAppServerOptionsTests.cs b/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/RemoteAppServerOptionsTests.cs index a6e54b3b12..9ab91f56b3 100644 --- a/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/RemoteAppServerOptionsTests.cs +++ b/test/Microsoft.AspNetCore.SystemWebAdapters.FrameworkServices.Tests/RemoteAppServerOptionsTests.cs @@ -27,12 +27,11 @@ public void VerifyIsCalled(string apiKeyHeader, string apiKey, bool shouldSuccee var services = new ServiceCollection(); var builder = new TestBuilder { Services = services }; - builder.AddRemoteAppServer(remote => remote - .Configure(options => - { - options.ApiKey = apiKey; - options.ApiKeyHeader = apiKeyHeader; - })); + builder.AddRemoteAppServer(options => + { + options.ApiKey = apiKey; + options.ApiKeyHeader = apiKeyHeader; + }); using var serviceProvider = services.BuildServiceProvider();