Skip to content

Commit

Permalink
feat(iot-serv): Add ability to send custom authentication scopes for …
Browse files Browse the repository at this point in the history
…RBAC auth (#3476)

Previously, the SDK hardcoded just "https://iothubs.azure.net/.default" as the only supported scope, but this does not work for non-public clouds

Also fix some out-of-date dependency issues and bump the service client version for a release
  • Loading branch information
timtay-microsoft authored Nov 21, 2024
1 parent 011494f commit 8606500
Show file tree
Hide file tree
Showing 63 changed files with 235 additions and 266 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Track1 .NET Azure IoT Hub and DPS SDKs

* @timtay-microsoft @abhipsaMisra @brycewang-microsoft @tmahmood-microsoft @patilsnr
* @timtay-microsoft @lev-i @olivakar @avishekpant
1 change: 1 addition & 0 deletions e2e/test/E2ETests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7" />
<PackageReference Include="System.Diagnostics.Tracing" Version="4.3.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
</ItemGroup>

<!-- Legacy .NET 4.5.1 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="System.Text.Json" Version="6.0.5" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.41.2" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.42.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.41.2" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.42.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsTestProject>True</IsTestProject>
<LangVersion>9.0</LangVersion>
<IsTestProject>False</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.41.2" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
8 changes: 4 additions & 4 deletions iothub/device/src/Microsoft.Azure.Devices.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Azure.Storage.Blobs" Version="12.19.1" />
<PackageReference Include="Microsoft.Azure.Amqp" Version="2.5.12" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
<PackageReference Include="Microsoft.Azure.Amqp" Version="2.6.9" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -111,7 +111,7 @@

<ItemGroup Condition=" '$(TargetFramework)' != 'net451' ">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
<PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
Expand Down
2 changes: 2 additions & 0 deletions iothub/device/src/Transport/AmqpIot/AmqpIotSendingLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ internal async Task<AmqpIotOutcome> SendMessagesAsync(IEnumerable<Message> messa

foreach (Message message in messages)
{
#pragma warning disable CA2000 // Dispose objects before losing scope
using AmqpMessage amqpMessage = AmqpIotMessageConverter.MessageToAmqpMessage(message);
#pragma warning restore CA2000 // Dispose objects before losing scope
var data = new Data
{
Value = AmqpIotMessageConverter.ReadStream(amqpMessage.ToStream()),
Expand Down
4 changes: 3 additions & 1 deletion iothub/device/src/Transport/Mqtt/MqttIotHubAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
using Microsoft.Azure.Devices.Shared;

#if NET5_0_OR_GREATER

using TaskCompletionSource = System.Threading.Tasks.TaskCompletionSource;

#else
using TaskCompletionSource = Microsoft.Azure.Devices.Shared.TaskCompletionSource;
#endif
Expand Down Expand Up @@ -1108,7 +1110,7 @@ private static IByteBuffer GetWillMessageBody(Message message)
{
Stream bodyStream = message.GetBodyStream();
byte[] buffer = new byte[bodyStream.Length];
bodyStream.Read(buffer, 0, buffer.Length);
_ = bodyStream.Read(buffer, 0, buffer.Length);
IByteBuffer copiedBuffer = Unpooled.CopiedBuffer(buffer);
return copiedBuffer;
}
Expand Down
12 changes: 6 additions & 6 deletions iothub/device/tests/Microsoft.Azure.Devices.Client.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Moq" Version="4.10.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.15">
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.17">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="System.Text.Json" Version="6.0.5" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="System.Text.Json" Version="6.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices" Version="1.38.1" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.39.1" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="System.Text.Json" Version="6.0.5" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.7.2" />
<PackageReference Include="Azure.Messaging.EventHubs" Version="5.11.5" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.11" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Core" Version="1.40.0" />
<PackageReference Include="Azure.Core" Version="1.44.1" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
</ItemGroup>

Expand Down
Loading

0 comments on commit 8606500

Please sign in to comment.