From 7569f14dd984d40739bcc284cd6158f2dba849b6 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 14 Mar 2019 22:32:10 +0000 Subject: [PATCH 1/6] Lock when removing disconnect handler --- .../IIS/AspNetCoreModuleV2/AspNetCore/DisconnectHandler.cpp | 1 + src/Servers/IIS/AspNetCoreModuleV2/CommonLib/requesthandler.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/Servers/IIS/AspNetCoreModuleV2/AspNetCore/DisconnectHandler.cpp b/src/Servers/IIS/AspNetCoreModuleV2/AspNetCore/DisconnectHandler.cpp index ad2ff17b47..5b8008fe5c 100644 --- a/src/Servers/IIS/AspNetCoreModuleV2/AspNetCore/DisconnectHandler.cpp +++ b/src/Servers/IIS/AspNetCoreModuleV2/AspNetCore/DisconnectHandler.cpp @@ -53,5 +53,6 @@ void DisconnectHandler::SetHandler(std::unique_ptr Date: Fri, 15 Mar 2019 23:32:58 +0000 Subject: [PATCH 2/6] Update patch config for ANCMV2 patch --- eng/PatchConfig.props | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index e84b9d1860..8f636df782 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -46,6 +46,7 @@ Later on, this will be checked using this condition: @aspnet/signalr; + Microsoft.AspNetCore.AspNetCoreModuleV2; From 46fac99de5f6a614c623fb447c5c7f37aa008c41 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 9 Apr 2019 21:11:55 -0700 Subject: [PATCH 3/6] Update branding to 2.2.5 - no ArchiveBaseline.*.txt additions necessary --- build/dependencies.props | 4 ++-- build/submodules.props | 2 +- eng/Baseline.Designer.props | 4 ++-- eng/Baseline.xml | 4 ++-- eng/PatchConfig.props | 4 ++++ version.props | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 6bd81edf5a..2d9e79f9d5 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,8 +2,8 @@ - 2.2.3 - 2.2.3 + 2.2.4 + 2.2.4 2.2.0 2.2.0 diff --git a/build/submodules.props b/build/submodules.props index 9bdda3f0a0..e9891e2224 100644 --- a/build/submodules.props +++ b/build/submodules.props @@ -37,6 +37,6 @@ - + diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index 87784eccc8..81096db09d 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -2,7 +2,7 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.2.3 + 2.2.4 @@ -81,7 +81,7 @@ - 2.2.2 + 2.2.4 diff --git a/eng/Baseline.xml b/eng/Baseline.xml index 094b040f20..07e02653d4 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -4,7 +4,7 @@ This file contains a list of all the packages and their versions which were rele build of ASP.NET Core 2.2.x. Update this list when preparing for a new patch. --> - + @@ -13,7 +13,7 @@ build of ASP.NET Core 2.2.x. Update this list when preparing for a new patch. - + diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index 8f636df782..cfc3c73d78 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -49,4 +49,8 @@ Later on, this will be checked using this condition: Microsoft.AspNetCore.AspNetCoreModuleV2; + + + + diff --git a/version.props b/version.props index cb564446e4..5aa246be58 100644 --- a/version.props +++ b/version.props @@ -2,7 +2,7 @@ 2 2 - 4 + 5 servicing $([System.DateTime]::Now.ToString('yyMMdd'))-99 From c53bd798c4c833ff0c73f1e4ad82d9f40b3f4057 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Tue, 9 Apr 2019 20:39:34 -0700 Subject: [PATCH 4/6] Update branding to 2.1.11 - no ArchiveBaseline.*.txt additions necessary --- build/dependencies.props | 4 ++-- eng/Baseline.Designer.props | 2 +- eng/Baseline.xml | 2 +- eng/PatchConfig.props | 7 +++++-- version.props | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/build/dependencies.props b/build/dependencies.props index 55ac87847c..57db423e18 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -2,8 +2,8 @@ - 2.1.9 - 2.1.9 + 2.1.10 + 2.1.10 4.5.2 diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index 190af91a42..a88565ad31 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -2,7 +2,7 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - 2.1.9 + 2.1.10 diff --git a/eng/Baseline.xml b/eng/Baseline.xml index a15dae40ff..e4001b8f78 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -4,7 +4,7 @@ This file contains a list of all the packages and their versions which were rele build of ASP.NET Core 2.1.x. Update this list when preparing for a new patch. --> - + diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index 187efa606a..29e74d4f85 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -18,14 +18,17 @@ Later on, this will be checked using this condition: Microsoft.AspNetCore.Authentication.Google; - - + + + + + diff --git a/version.props b/version.props index ec99366288..13a113a115 100644 --- a/version.props +++ b/version.props @@ -2,7 +2,7 @@ 2 1 - 10 + 11 servicing Servicing t000 From 74951717bc0044e955807b9800015fb7d41fc647 Mon Sep 17 00:00:00 2001 From: Mikael Mengistu Date: Wed, 10 Apr 2019 13:14:15 -0700 Subject: [PATCH 5/6] backport accessTokenProvider fix (#8726) --- .../com/microsoft/signalr/HubConnection.java | 7 +- .../microsoft/signalr/HubConnectionTest.java | 82 +++++++++++++++++++ 2 files changed, 87 insertions(+), 2 deletions(-) diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java b/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java index 9b76b389f5..f3ae4484dd 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java +++ b/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java @@ -44,6 +44,7 @@ public class HubConnection { private List onClosedCallbackList; private final boolean skipNegotiate; private Single accessTokenProvider; + private Single redirectAccessTokenProvider; private final Map headers = new HashMap<>(); private ConnectionState connectionState = null; private final HttpClient httpClient; @@ -240,11 +241,11 @@ public class HubConnection { } if (negotiateResponse.getAccessToken() != null) { - this.accessTokenProvider = Single.just(negotiateResponse.getAccessToken()); + this.redirectAccessTokenProvider = Single.just(negotiateResponse.getAccessToken()); String token = ""; // We know the Single is non blocking in this case // It's fine to call blockingGet() on it. - token = this.accessTokenProvider.blockingGet(); + token = this.redirectAccessTokenProvider.blockingGet(); this.headers.put("Authorization", "Bearer " + token); } @@ -433,6 +434,8 @@ public class HubConnection { logger.info("HubConnection stopped."); hubConnectionState = HubConnectionState.DISCONNECTED; handshakeResponseSubject.onComplete(); + redirectAccessTokenProvider = null; + this.headers.remove("Authorization"); } finally { hubConnectionStateLock.unlock(); } diff --git a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java b/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java index c46de57b3e..283dd1644d 100644 --- a/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java +++ b/src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java @@ -1213,4 +1213,86 @@ class HubConnectionTest { () -> hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait()); assertEquals("Unexpected status code returned from negotiate: 500 Internal server error.", exception.getMessage()); } + + @Test + public void accessTokenProviderReferenceIsKeptAfterNegotiateRedirect() { + AtomicReference token = new AtomicReference<>(); + AtomicReference beforeRedirectToken = new AtomicReference<>(); + + TestHttpClient client = new TestHttpClient() + .on("POST", "http://example.com/negotiate", (req) -> { + beforeRedirectToken.set(req.getHeaders().get("Authorization")); + return Single.just(new HttpResponse(200, "", "{\"url\":\"http://testexample.com/\",\"accessToken\":\"newToken\"}")); + }) + .on("POST", "http://testexample.com/negotiate", (req) -> { + token.set(req.getHeaders().get("Authorization")); + return Single.just(new HttpResponse(200, "", "{\"connectionId\":\"bVOiRPG8-6YiJ6d7ZcTOVQ\",\"" + + "availableTransports\":[{\"transport\":\"WebSockets\",\"transferFormats\":[\"Text\",\"Binary\"]}]}")); + }); + + MockTransport transport = new MockTransport(true); + HubConnection hubConnection = HubConnectionBuilder + .create("http://example.com") + .withTransport(transport) + .withHttpClient(client) + .withAccessTokenProvider(Single.just("User Registered Token")) + .build(); + + hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait(); + assertEquals(HubConnectionState.CONNECTED, hubConnection.getConnectionState()); + hubConnection.stop().timeout(1, TimeUnit.SECONDS).blockingAwait(); + assertEquals("Bearer User Registered Token", beforeRedirectToken.get()); + assertEquals("Bearer newToken", token.get()); + + // Clear the tokens to see if they get reset to the proper values + beforeRedirectToken.set(""); + token.set(""); + + // Restart the connection to make sure that the orignal accessTokenProvider that we registered is still registered before the redirect. + hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait(); + assertEquals(HubConnectionState.CONNECTED, hubConnection.getConnectionState()); + hubConnection.stop(); + assertEquals("Bearer User Registered Token", beforeRedirectToken.get()); + assertEquals("Bearer newToken", token.get()); + } + + @Test + public void authorizationHeaderFromNegotiateGetsClearedAfterStopping() { + AtomicReference token = new AtomicReference<>(); + AtomicReference beforeRedirectToken = new AtomicReference<>(); + + TestHttpClient client = new TestHttpClient() + .on("POST", "http://example.com/negotiate", (req) -> { + beforeRedirectToken.set(req.getHeaders().get("Authorization")); + return Single.just(new HttpResponse(200, "", "{\"url\":\"http://testexample.com/\",\"accessToken\":\"newToken\"}")); + }) + .on("POST", "http://testexample.com/negotiate", (req) -> { + token.set(req.getHeaders().get("Authorization")); + return Single.just(new HttpResponse(200, "", "{\"connectionId\":\"bVOiRPG8-6YiJ6d7ZcTOVQ\",\"" + + "availableTransports\":[{\"transport\":\"WebSockets\",\"transferFormats\":[\"Text\",\"Binary\"]}]}")); + }); + + MockTransport transport = new MockTransport(true); + HubConnection hubConnection = HubConnectionBuilder + .create("http://example.com") + .withTransport(transport) + .withHttpClient(client) + .build(); + + hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait(); + assertEquals(HubConnectionState.CONNECTED, hubConnection.getConnectionState()); + hubConnection.stop().timeout(1, TimeUnit.SECONDS).blockingAwait(); + assertEquals("Bearer newToken", token.get()); + + // Clear the tokens to see if they get reset to the proper values + beforeRedirectToken.set(""); + token.set(""); + + // Restart the connection to make sure that the orignal accessTokenProvider that we registered is still registered before the redirect. + hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait(); + assertEquals(HubConnectionState.CONNECTED, hubConnection.getConnectionState()); + hubConnection.stop(); + assertNull(beforeRedirectToken.get()); + assertEquals("Bearer newToken", token.get()); + } } From 7acf98a16ccb45183551750e46b544da04f1f2b7 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Wed, 10 Apr 2019 20:53:00 -0700 Subject: [PATCH 6/6] update SignalR Java client signing cert (#9049) --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index 27ee2ab8ff..4a6e83fea0 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -58,7 +58,7 @@ Microsoft400 NuGet VsixSHA2 - MicrosoftJAR + MicrosoftJARSHA2