-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Refactor global Web PubSub connection Options setup in preparation fo… #54209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…r AAD * Abstract Web PubSub access credential into a new class, unifies identity-based connection and key-based connection * Add a util class to create Web PubSub access object from conneciton string or identity-based connection * Unify global service access info into `WebPubSubServiceAccessOptions`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the Web PubSub connection configuration to prepare for Azure Active Directory (AAD) authentication support. It abstracts the access credentials into a unified model that supports both key-based and identity-based authentication.
- Introduces a credential abstraction layer with
WebPubSubServiceCredential,KeyCredential, andIdentityCredentialclasses - Adds utility class
WebPubSubServiceAccessUtilto parse connection strings and read identity-based configuration - Unifies service access information into
WebPubSubServiceAccessOptionswith corresponding setup class
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| WebPubSubServiceCredential.cs | Defines abstract credential base class with KeyCredential and IdentityCredential implementations |
| WebPubSubServiceAccess.cs | Encapsulates service endpoint and credential information |
| WebPubSubServiceAccessUtil.cs | Provides utility methods to create service access from connection strings and configuration |
| WebPubSubServiceAccessOptions.cs | Options class for global service access configuration |
| WebPubSubServiceAccessOptionsSetup.cs | Configures service access options from multiple configuration sources |
| WebPubSubJobsBuilderExtensions.cs | Registers the new options setup and Azure client dependencies |
| Constants.cs | Adds serviceUri constant for identity-based connections |
| Microsoft.Azure.WebJobs.Extensions.WebPubSub.csproj | Adds Microsoft.Extensions.Azure package reference and removes API compatibility check |
| WebPubSubServiceAccessUtilTests.cs | Comprehensive tests for the utility class methods |
| WebPubSubServiceAccessOptionsSetupTests.cs | Tests for options setup configuration logic |
| var tokenCrential = azureComponentFactory.CreateTokenCredential(section); | ||
| result = new WebPubSubServiceAccess(endpoint, new IdentityCredential(tokenCrential)); |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'tokenCrential' to 'tokenCredential'.
| var tokenCrential = azureComponentFactory.CreateTokenCredential(section); | |
| result = new WebPubSubServiceAccess(endpoint, new IdentityCredential(tokenCrential)); | |
| var tokenCredential = azureComponentFactory.CreateTokenCredential(section); | |
| result = new WebPubSubServiceAccess(endpoint, new IdentityCredential(tokenCredential)); |
| Assert.IsNotNull(options.DefaultWebPubSubAccess); | ||
| Assert.AreEqual(new System.Uri(TestServiceUri), options.DefaultWebPubSubAccess.ServiceEndpoint); |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests reference DefaultWebPubSubAccess property, but the actual implementation in WebPubSubServiceAccessOptions uses WebPubSubAccess as the property name. This mismatch will cause the tests to fail at compilation.
| Assert.IsNotNull(result); | ||
| Assert.AreEqual(new Uri(serviceUri), result.ServiceEndpoint); | ||
| Assert.IsInstanceOf<IdentityCredential>(result.Credential); | ||
| var identityCredential = (IdentityCredential)result.Credential; |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable identityCredential is declared but never used. Either remove this unused variable or add assertions to verify its properties.
| var identityCredential = (IdentityCredential)result.Credential; |
| <Version>1.10.0-beta.1</Version> | ||
| <!--The ApiCompatVersion is managed automatically and should not generally be modified manually.--> | ||
| <ApiCompatVersion>1.9.0</ApiCompatVersion> | ||
| <!--Removed ApiCompatVersion to skip ApiCompatability check to update binding attributes. They'll be added back automatically after release.--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert. API Compat checks are required. If its failing, then you've got a binary breaking change which is not permitted.
…r AAD
WebPubSubServiceAccessOptions.