Skip to content

Commit

Permalink
Revert "fix"
Browse files Browse the repository at this point in the history
This reverts commit 131c575.
  • Loading branch information
YunchuWang committed Jan 9, 2025
1 parent 131c575 commit 65fa607
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
24 changes: 11 additions & 13 deletions src/Extensions/Azure/DurableTaskSchedulerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation.
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Azure.Core;
Expand Down Expand Up @@ -141,20 +141,18 @@ options.Credential is not null
ChannelCredentials.SecureSsl :
ChannelCredentials.Insecure;
return GrpcChannel.ForAddress(endpoint, new GrpcChannelOptions
{
// The same credential is being used for all operations.
// https://learn.microsoft.com/aspnet/core/grpc/authn-and-authz#set-the-bearer-token-with-callcredentials
Credentials = ChannelCredentials.Create(channelCreds, managedBackendCreds),

return GrpcChannel.ForAddress(endpoint, new GrpcChannelOptions
{
// The same credential is being used for all operations.
// https://learn.microsoft.com/aspnet/core/grpc/authn-and-authz#set-the-bearer-token-with-callcredentials
Credentials = ChannelCredentials.Create(channelCreds, managedBackendCreds),

// TODO: This is not appropriate for use in production settings. Setting this to true should
// only be done for local testing. We should hide this setting behind some kind of flag.
UnsafeUseInsecureChannelCallCredentials = true,
});
// TODO: This is not appropriate for use in production settings. Setting this to true should
// only be done for local testing. We should hide this setting behind some kind of flag.
UnsafeUseInsecureChannelCallCredentials = true,
});
}

static ArgumentException RequiredOptionMissing(string optionName)
static Exception RequiredOptionMissing(string optionName)

Check warning on line 155 in src/Extensions/Azure/DurableTaskSchedulerExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Change return type of method 'RequiredOptionMissing' from 'System.Exception' to 'System.ArgumentException' for improved performance (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859)

Check warning on line 155 in src/Extensions/Azure/DurableTaskSchedulerExtensions.cs

View workflow job for this annotation

GitHub Actions / build

Change return type of method 'RequiredOptionMissing' from 'System.Exception' to 'System.ArgumentException' for improved performance (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1859)
{
return new ArgumentException(message: $"Required option '{optionName}' was not provided.");
}
Expand All @@ -181,4 +179,4 @@ public async Task<AccessToken> GetTokenAsync(CancellationToken cancellationToken
return this.token.Value;
}
}
}
}

Check warning on line 182 in src/Extensions/Azure/DurableTaskSchedulerExtensions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Check warning on line 182 in src/Extensions/Azure/DurableTaskSchedulerExtensions.cs

View workflow job for this annotation

GitHub Actions / build

9 changes: 4 additions & 5 deletions src/Extensions/Azure/DurableTaskSchedulerOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// Licensed under the MIT License.

Check warning on line 2 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Check warning on line 2 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / build


using System.Globalization;
using Azure.Core;
Expand All @@ -15,9 +15,6 @@ public class DurableTaskSchedulerOptions
/// <summary>
/// Initializes a new instance of the <see cref="DurableTaskSchedulerOptions"/> class.
/// </summary>
/// <param name="endpointAddress">The endpoint address of the Durable Task Scheduler service.</param>
/// <param name="taskHubName">The name of the task hub to connect to.</param>
/// <param name="credential">The credential to use for authentication, or null for no authentication.</param>
internal DurableTaskSchedulerOptions(string endpointAddress, string taskHubName, TokenCredential? credential = null)

Check warning on line 18 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The documentation for parameter 'endpointAddress' is missing (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1611.md)

Check warning on line 18 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The documentation for parameter 'taskHubName' is missing (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1611.md)

Check warning on line 18 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Check warning on line 18 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / build

The documentation for parameter 'endpointAddress' is missing (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1611.md)

Check warning on line 18 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / build

The documentation for parameter 'taskHubName' is missing (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1611.md)

Check warning on line 18 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / build

{
this.EndpointAddress = endpointAddress ?? throw new ArgumentNullException(nameof(endpointAddress));
Expand Down Expand Up @@ -77,6 +74,7 @@ public static DurableTaskSchedulerOptions FromConnectionString(
// "Endpoint=https://myaccount.westus3.durabletask.io/;Authentication=ManagedIdentity;ClientID=00000000-0000-0000-0000-000000000000;TaskHubName=th01"
// "Endpoint=https://myaccount.westus3.durabletask.io/;Authentication=DefaultAzure;TaskHubName=th01"
// "Endpoint=https://myaccount.westus3.durabletask.io/;Authentication=None;TaskHubName=th01" (undocumented and only intended for local testing)

Check warning on line 76 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Single-line comments should not be followed by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1512.md)

Check warning on line 76 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / build

Single-line comments should not be followed by blank line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1512.md)

string endpointAddress = connectionString.Endpoint;

if (!endpointAddress.Contains("://"))
Expand All @@ -86,6 +84,7 @@ public static DurableTaskSchedulerOptions FromConnectionString(
}

string authType = connectionString.Authentication;

TokenCredential? credential;

// Parse the supported auth types, in a case-insensitive way and without spaces
Expand Down Expand Up @@ -160,4 +159,4 @@ public static DurableTaskSchedulerOptions FromConnectionString(
DurableTaskSchedulerOptions options = new(endpointAddress, connectionString.TaskHubName, credential);
return options;
}
}
}

Check warning on line 162 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Check warning on line 162 in src/Extensions/Azure/DurableTaskSchedulerOptions.cs

View workflow job for this annotation

GitHub Actions / build

0 comments on commit 65fa607

Please sign in to comment.