Skip to content

Commit 131c575

Browse files
committed
fix
1 parent 6a66aaa commit 131c575

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/Extensions/Azure/DurableTaskSchedulerExtensions.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

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

149-
// TODO: This is not appropriate for use in production settings. Setting this to true should
150-
// only be done for local testing. We should hide this setting behind some kind of flag.
151-
UnsafeUseInsecureChannelCallCredentials = true,
152-
});
145+
return GrpcChannel.ForAddress(endpoint, new GrpcChannelOptions
146+
{
147+
// The same credential is being used for all operations.
148+
// https://learn.microsoft.com/aspnet/core/grpc/authn-and-authz#set-the-bearer-token-with-callcredentials
149+
Credentials = ChannelCredentials.Create(channelCreds, managedBackendCreds),
150+
151+
// TODO: This is not appropriate for use in production settings. Setting this to true should
152+
// only be done for local testing. We should hide this setting behind some kind of flag.
153+
UnsafeUseInsecureChannelCallCredentials = true,
154+
});
153155
}
154156

155-
static Exception RequiredOptionMissing(string optionName)
157+
static ArgumentException RequiredOptionMissing(string optionName)
156158
{
157159
return new ArgumentException(message: $"Required option '{optionName}' was not provided.");
158160
}
@@ -179,4 +181,4 @@ public async Task<AccessToken> GetTokenAsync(CancellationToken cancellationToken
179181
return this.token.Value;
180182
}
181183
}
182-
}
184+
}

src/Extensions/Azure/DurableTaskSchedulerOptions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) Microsoft Corporation.
2-
// Licensed under the MIT License.
2+
// Licensed under the MIT License.
33

44
using System.Globalization;
55
using Azure.Core;
@@ -15,6 +15,9 @@ public class DurableTaskSchedulerOptions
1515
/// <summary>
1616
/// Initializes a new instance of the <see cref="DurableTaskSchedulerOptions"/> class.
1717
/// </summary>
18+
/// <param name="endpointAddress">The endpoint address of the Durable Task Scheduler service.</param>
19+
/// <param name="taskHubName">The name of the task hub to connect to.</param>
20+
/// <param name="credential">The credential to use for authentication, or null for no authentication.</param>
1821
internal DurableTaskSchedulerOptions(string endpointAddress, string taskHubName, TokenCredential? credential = null)
1922
{
2023
this.EndpointAddress = endpointAddress ?? throw new ArgumentNullException(nameof(endpointAddress));
@@ -74,7 +77,6 @@ public static DurableTaskSchedulerOptions FromConnectionString(
7477
// "Endpoint=https://myaccount.westus3.durabletask.io/;Authentication=ManagedIdentity;ClientID=00000000-0000-0000-0000-000000000000;TaskHubName=th01"
7578
// "Endpoint=https://myaccount.westus3.durabletask.io/;Authentication=DefaultAzure;TaskHubName=th01"
7679
// "Endpoint=https://myaccount.westus3.durabletask.io/;Authentication=None;TaskHubName=th01" (undocumented and only intended for local testing)
77-
7880
string endpointAddress = connectionString.Endpoint;
7981

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

8688
string authType = connectionString.Authentication;
87-
8889
TokenCredential? credential;
8990

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

0 commit comments

Comments
 (0)