Skip to content

Conversation

@Y-Sindo
Copy link
Member

@Y-Sindo Y-Sindo commented Nov 28, 2025

…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.

…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`.
@Y-Sindo Y-Sindo requested a review from vicancy as a code owner November 28, 2025 08:47
Copilot AI review requested due to automatic review settings November 28, 2025 08:47
Copilot finished reviewing on behalf of Y-Sindo November 28, 2025 08:49
Copy link
Contributor

Copilot AI left a 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, and IdentityCredential classes
  • Adds utility class WebPubSubServiceAccessUtil to parse connection strings and read identity-based configuration
  • Unifies service access information into WebPubSubServiceAccessOptions with 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

Comment on lines +89 to +90
var tokenCrential = azureComponentFactory.CreateTokenCredential(section);
result = new WebPubSubServiceAccess(endpoint, new IdentityCredential(tokenCrential));
Copy link

Copilot AI Nov 28, 2025

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'.

Suggested change
var tokenCrential = azureComponentFactory.CreateTokenCredential(section);
result = new WebPubSubServiceAccess(endpoint, new IdentityCredential(tokenCrential));
var tokenCredential = azureComponentFactory.CreateTokenCredential(section);
result = new WebPubSubServiceAccess(endpoint, new IdentityCredential(tokenCredential));

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +42
Assert.IsNotNull(options.DefaultWebPubSubAccess);
Assert.AreEqual(new System.Uri(TestServiceUri), options.DefaultWebPubSubAccess.ServiceEndpoint);
Copy link

Copilot AI Nov 28, 2025

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.

Copilot uses AI. Check for mistakes.
Assert.IsNotNull(result);
Assert.AreEqual(new Uri(serviceUri), result.ServiceEndpoint);
Assert.IsInstanceOf<IdentityCredential>(result.Credential);
var identityCredential = (IdentityCredential)result.Credential;
Copy link

Copilot AI Nov 28, 2025

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.

Suggested change
var identityCredential = (IdentityCredential)result.Credential;

Copilot uses AI. Check for mistakes.
<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.-->
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants