Support Authentication Refresh for Azure SignalR (Default mode)#2277
Merged
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
vwxyzh
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Default-mode SDK side of #2278. See the issue for the full background, API design, and behavior/semantics. This PR is the server-SDK implementation.
What this PR does
Lets an app refresh an Azure SignalR client connection's auth expiration and application claims without reconnecting. The SDK intercepts
{hubUrl}/refreshfor ASRS-connected hubs and applies the refresh over the service connection. Apps opt in through the sameHttpConnectionDispatcherOptionsself-hosted SignalR uses without new public API introduced in Microsoft.Azure.SignalR.Changes
All new code is
internaland net11-guarded (#if NET11_0_OR_GREATER);netstandard2.0/net8.0builds are unaffected. The service protocol messagesRefreshAuthMessage(41),GetConnectionClaimsMessage(42),UpdateConnectionClaimsMessage(43) have already been released in v1.33.1.AuthRefreshMatcherPolicy— intercepts/refreshfor ASRS-connected hubs.RefreshHandler— request validation + optionalOnAuthenticationRefreshgate; sendsRefreshAuthMessage; mints the refreshed service access token; returns{ accessToken, tokenLifetimeSeconds }or{ error }.NegotiateHandler— advertisestokenLifetimeSecondsfor eligible connections.UpdateConnectionClaimsMessagetoContext.User(IConnectionUserFeature+ net11IConnectionUserRefreshFeature), thenHub.OnAuthenticationRefreshedAsync()runs.RefreshConnectionAuthAsync/GetConnectionClaimsAsyncwith new result records;AckHandlercarries claim payloads;AckStatus.Forbiddenadded.ServiceEndpoint(no rebalance / re-negotiate).net11.0target; workflows install the .NET 11 daily SDK (Remove it when .NET 11 is GA)Not in scope
NotSupportedException(// TODO: Serverless refresh support); a later PR implements it.Tests
RefreshAuthFacts— handler success, gating (opt-in / auth / Windows / anonymous),OnAuthenticationRefreshaccept/reject, typed failures, token minting.MultiEndpointServiceConnectionContainerTests— owner pinning, fan-out discovery, ambiguous-owner failure.ServiceHubDispatcherTests+ test-infra updates for the new container/manager members.