Skip to content
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

Continue consolidating the auth methods for the hub device #2854

Merged
merged 24 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dc32d00
consolidate SasTokenBuilder and SharedAccessSignatureBuilder
brycewang-microsoft Oct 10, 2022
ec901bc
Merge branch 'previews/v2' into brycewang/auth-consolidate
brycewang-microsoft Oct 12, 2022
7391aca
combine ClientAuthenticationWithTokenRefresh with AuthenticationWith…
brycewang-microsoft Oct 12, 2022
b9dc3a0
Merge branch 'previews/v2' into brycewang/auth-consolidate
brycewang-microsoft Oct 12, 2022
99fba42
comment fix
brycewang-microsoft Oct 12, 2022
11fb457
Merge branch 'previews/v2' into brycewang/auth-consolidate
brycewang-microsoft Oct 17, 2022
57dcedb
rename AuthenticationWithTokenRefresh to ClientAuthenticationWithToke…
brycewang-microsoft Oct 17, 2022
e70901f
make ClientAuthenticationWithSakRefresh public, remove ClientAuthenti…
brycewang-microsoft Oct 18, 2022
528cd8c
remove ClientAuthenticationWithConnectionString
brycewang-microsoft Oct 18, 2022
0c8ef1a
fixup unit tests
brycewang-microsoft Oct 18, 2022
df1d21f
make x509 cert null when populating with connection string, and add l…
brycewang-microsoft Oct 18, 2022
a7869e0
fixup BuildSignature in SharedAccessSignatureBuilder on the hub devic…
brycewang-microsoft Oct 19, 2022
709a216
pr comments
brycewang-microsoft Oct 19, 2022
63ea242
rename ClientAuthenticationWithSakRefresh to ClientAuthenticationWith…
brycewang-microsoft Oct 19, 2022
05ba613
update migration doc
brycewang-microsoft Oct 19, 2022
5828994
fixup
brycewang-microsoft Oct 19, 2022
e0c0bd8
add overloaded ctor into ClientAuthenticationWithSharedAccessKeyRefre…
brycewang-microsoft Oct 19, 2022
7f597e7
add overloaded ctor into ClientAuthenticationWithX509Certificate and …
brycewang-microsoft Oct 20, 2022
5ca006d
simplify ctor in ClientAuthenticationWithTokenRefresh
brycewang-microsoft Oct 20, 2022
784c67c
merge from previews/v2
brycewang-microsoft Oct 20, 2022
3aac26b
fixup
brycewang-microsoft Oct 20, 2022
63a5858
merge from previews/v2
brycewang-microsoft Oct 20, 2022
687b28d
merge from previews/v2
brycewang-microsoft Oct 20, 2022
5c87e28
merge
brycewang-microsoft Oct 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions e2e/test/iothub/DeviceTokenRefreshE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public async Task IotHubDeviceClient_TokenConnectionDoubleRelease_Ok()
Target = $"{iotHub}/devices/{WebUtility.UrlEncode(deviceId)}",
};

var auth = new ClientAuthenticationWithToken(builder.ToSignature(), deviceId);
var auth = new ClientAuthenticationWithSharedAccessSignature(builder.ToSignature(), deviceId);

using var deviceClient = new IotHubDeviceClient(iotHub, auth, new IotHubClientOptions(new IotHubClientAmqpSettings()));
Logger.Trace($"{deviceId}: Created {nameof(IotHubDeviceClient)} ID={TestLogger.IdOf(deviceClient)}");
Expand Down Expand Up @@ -140,7 +140,7 @@ public async Task IotHubDeviceClient_CreateFromConnectionString_TokenIsRefreshed
using var deviceDisconnected = new SemaphoreSlim(0);

TestDevice testDevice = await TestDevice.GetTestDeviceAsync(Logger, DevicePrefix).ConfigureAwait(false);
var auth = new ClientAuthenticationWithConnectionString(testDevice.ConnectionString, sasTokenTimeToLive, sasTokenRenewalBuffer);
var auth = new ClientAuthenticationWithSakRefresh(testDevice.ConnectionString, sasTokenTimeToLive, sasTokenRenewalBuffer);

var options = new IotHubClientOptions(new IotHubClientMqttSettings());

Expand Down Expand Up @@ -283,7 +283,7 @@ private class TestTokenRefresher : ClientAuthenticationWithTokenRefresh

private readonly MsTestLogger _logger;

public TestTokenRefresher(string deviceId, string key, MsTestLogger logger) : base(deviceId)
public TestTokenRefresher(string deviceId, string key, MsTestLogger logger) : base(deviceId: deviceId)
brycewang-microsoft marked this conversation as resolved.
Show resolved Hide resolved
{
_key = key;
_logger = logger;
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/provisioning/ProvisioningE2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ public static ProvisioningClientOptions CreateProvisioningClientOptionsFromName(
}
else if (provisioningAuth is AuthenticationProviderSymmetricKey symmetricKeyAuth)
{
auth = new ClientAuthenticationWithRegistrySymmetricKey(symmetricKeyAuth.GetPrimaryKey(), deviceId);
auth = new ClientAuthenticationWithSakRefresh(symmetricKeyAuth.GetPrimaryKey(), deviceId);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static async Task<IotHubDeviceClient> SetupDeviceClientAsync(Parameters
case "dps":
logger.LogDebug($"Initializing via DPS");
DeviceRegistrationResult dpsRegistrationResult = await ProvisionDeviceAsync(parameters, cancellationToken);
var authMethod = new ClientAuthenticationWithRegistrySymmetricKey(parameters.DeviceSymmetricKey, dpsRegistrationResult.DeviceId);
var authMethod = new ClientAuthenticationWithSakRefresh(parameters.DeviceSymmetricKey, dpsRegistrationResult.DeviceId);
deviceClient = InitializeDeviceClient(dpsRegistrationResult.AssignedHub, authMethod);
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private static async Task<IotHubDeviceClient> SetupDeviceClientAsync(Parameters
case "dps":
logger.LogDebug($"Initializing via DPS");
DeviceRegistrationResult dpsRegistrationResult = await ProvisionDeviceAsync(parameters, cancellationToken);
var authMethod = new ClientAuthenticationWithRegistrySymmetricKey(parameters.DeviceSymmetricKey, dpsRegistrationResult.DeviceId);
var authMethod = new ClientAuthenticationWithSakRefresh(parameters.DeviceSymmetricKey, dpsRegistrationResult.DeviceId);
deviceClient = InitializeDeviceClient(dpsRegistrationResult.AssignedHub, authMethod);
break;

Expand Down
143 changes: 0 additions & 143 deletions iothub/device/src/Authentication/AuthenticationWithTokenRefresh.cs

This file was deleted.

This file was deleted.