Skip to content

Commit f56a617

Browse files
author
Release-Agent
committed
''
1 parent 4a44cfa commit f56a617

File tree

8 files changed

+65
-20
lines changed

8 files changed

+65
-20
lines changed

src/Build.Shared.props

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
<PackageVersion_CrmProxy>4.9.3165-v9.0-weekly-2304.2</PackageVersion_CrmProxy>
1313
<PackageVersion_CDSServerNuget>4.6.6061-weekly-2108.5</PackageVersion_CDSServerNuget>
1414
<PackageVersion_Newtonsoft>13.0.1</PackageVersion_Newtonsoft>
15-
<PackageVersion_RestClientRuntime>2.3.20</PackageVersion_RestClientRuntime>
15+
<PackageVersion_RestClientRuntime>2.3.24</PackageVersion_RestClientRuntime>
1616
<PackageVersion_XrmSdk>9.0.2.48</PackageVersion_XrmSdk>
1717
<PackageVersion_Dep_OutlookXrmSdk>9.0.2.34</PackageVersion_Dep_OutlookXrmSdk>
1818
<PackageVersion_BatchedTelemetry>3.0.8</PackageVersion_BatchedTelemetry>
1919
<PackageVersion_DataverseClient>0.4.20</PackageVersion_DataverseClient>
2020
<PackageVersion_CoverletCollector>3.1.0</PackageVersion_CoverletCollector>
2121
<PackageVersion_Microsoft_Extensions>3.1.8</PackageVersion_Microsoft_Extensions>
22-
<PackageVersion_SystemRuntime>6.0.0</PackageVersion_SystemRuntime>
22+
<PackageVersion_SystemRuntime>6.0.0</PackageVersion_SystemRuntime>
23+
<PackageVersion_SystemTextJsonVersion>7.0.3</PackageVersion_SystemTextJsonVersion>
24+
<PackageVersion_SystemTextEncodingsWebVersion>7.0.0</PackageVersion_SystemTextEncodingsWebVersion>
2325

2426
<!-- Test: -->
2527
<PackageVersion_MicrosoftNETTestSdk>17.5.0</PackageVersion_MicrosoftNETTestSdk>

src/GeneralTools/DataverseClient/Client/ConnectionService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ internal sealed class ConnectionService : IConnectionService, IDisposable
139139
/// <summary>
140140
/// Client or App Id to use.
141141
/// </summary>
142-
private string _clientId;
142+
internal string _clientId;
143143

144144
/// <summary>
145145
/// uri specifying the redirection uri post OAuth auth
@@ -149,7 +149,7 @@ internal sealed class ConnectionService : IConnectionService, IDisposable
149149
/// <summary>
150150
/// Resource to connect to
151151
/// </summary>
152-
private string _resource;
152+
internal string _resource;
153153

154154
/// <summary>
155155
/// cached authority reading from credential manager
@@ -1570,7 +1570,7 @@ private async Task<IOrganizationService> DoDirectLoginAsync(bool IsOnPrem = fals
15701570

15711571
if (dvService != null)
15721572
{
1573-
OrganizationVersion = Version.Parse("9.0");
1573+
OrganizationVersion = Version.Parse("9.0.0.0");
15741574
//await GetServerVersion(dvService, _targetInstanceUriToConnectTo).ConfigureAwait(false);
15751575
//await RefreshInstanceDetails(dvService, _targetInstanceUriToConnectTo).ConfigureAwait(false);
15761576
// Format the URL for WebAPI service.

src/GeneralTools/DataverseClient/Client/Microsoft.PowerPlatform.Dataverse.Client.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(PackageVersion_Microsoft_Extensions)" />
4646
<PackageReference Include="System.Drawing.Common" Version="5.0.3" /> <!-- explict add to deal with CVE-2021-24112 -->
4747
<PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.1" /> <!-- explict add to deal with CVE-2022-34716 -->
48+
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.3" /> <!-- explict add to deal with CVE-2023-29331 -->
4849
</ItemGroup>
4950

5051
<ItemGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'net472' or '$(TargetFramework)' == 'net48'">

src/GeneralTools/DataverseClient/Client/ServiceClient.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,19 @@ public string CurrentAccessToken
300300
if (_connectionSvc != null && (
301301
_connectionSvc.AuthenticationTypeInUse == AuthenticationType.OAuth ||
302302
_connectionSvc.AuthenticationTypeInUse == AuthenticationType.Certificate ||
303-
_connectionSvc.AuthenticationTypeInUse == AuthenticationType.ExternalTokenManagement ||
304303
_connectionSvc.AuthenticationTypeInUse == AuthenticationType.ClientSecret))
305304
{
306-
return _connectionSvc.RefreshClientTokenAsync().ConfigureAwait(false).GetAwaiter().GetResult();
305+
if (_connectionSvc._authenticationResultContainer != null && !string.IsNullOrEmpty(_connectionSvc._resource) && !string.IsNullOrEmpty(_connectionSvc._clientId))
306+
{
307+
if (_connectionSvc._authenticationResultContainer.ExpiresOn.ToUniversalTime() < DateTime.UtcNow.AddMinutes(1))
308+
{
309+
// Force a refresh if the token is about to expire
310+
return _connectionSvc.RefreshClientTokenAsync().ConfigureAwait(false).GetAwaiter().GetResult();
311+
}
312+
return _connectionSvc._authenticationResultContainer.AccessToken;
313+
}
314+
// if not configured, return empty string
315+
return string.Empty;
307316
}
308317
else
309318
return string.Empty;
@@ -512,7 +521,7 @@ public Guid? CallerAADObjectId
512521
if (_connectionSvc?.OrganizationVersion != null)
513522
{
514523
_connectionSvc.CallerAADObjectId = null; // Null value as this is not supported for this version.
515-
_logEntry.Log($"Setting CallerAADObject ID not supported in version {_connectionSvc?.OrganizationVersion}");
524+
_logEntry.Log($"Setting CallerAADObject ID not supported in version {_connectionSvc?.OrganizationVersion}. Dataverse version {Utilities.FeatureVersionMinimums.AADCallerIDSupported} or higher is required.", TraceEventType.Warning);
516525
}
517526
}
518527
}
@@ -544,7 +553,7 @@ public Guid? SessionTrackingId
544553
if (_connectionSvc?.OrganizationVersion != null)
545554
{
546555
_connectionSvc.SessionTrackingId = null; // Null value as this is not supported for this version.
547-
_logEntry.Log($"Setting SessionTrackingId ID not supported in version {_connectionSvc?.OrganizationVersion}");
556+
_logEntry.Log($"Setting SessionTrackingId ID not supported in version {_connectionSvc?.OrganizationVersion}. Dataverse version {Utilities.FeatureVersionMinimums.SessionTrackingSupported} or greater is required.", TraceEventType.Warning);
548557
}
549558
}
550559
}
@@ -576,7 +585,7 @@ public bool ForceServerMetadataCacheConsistency
576585
if (_connectionSvc?.OrganizationVersion != null)
577586
{
578587
_connectionSvc.ForceServerCacheConsistency = false; // Null value as this is not supported for this version.
579-
_logEntry.Log($"Setting ForceServerMetadataCacheConsistency not supported in version {_connectionSvc?.OrganizationVersion}");
588+
_logEntry.Log($"Setting ForceServerMetadataCacheConsistency not supported in version {_connectionSvc?.OrganizationVersion}. Dataverse version {Utilities.FeatureVersionMinimums.ForceConsistencySupported} or higher is required." , TraceEventType.Warning);
580589
}
581590
}
582591
}

src/GeneralTools/DataverseClient/UnitTests/CdsClient_Core_Tests/ServiceClientTests.cs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,9 +743,8 @@ public void TestResponseHeaderBehavior()
743743

744744
[SkippableConnectionTest]
745745
[Trait("Category", "Live Connect Required")]
746-
public void RetrieveSolutionImportResultAsyncTest()
746+
public void RetrieveSolutionImportResultAsyncTestWithSyncImport()
747747
{
748-
// Import
749748
var client = CreateServiceClient();
750749
if (!Utilities.FeatureVersionMinimums.IsFeatureValidForEnviroment(client._connectionSvc?.OrganizationVersion, Utilities.FeatureVersionMinimums.AllowRetrieveSolutionImportResult))
751750
{
@@ -754,17 +753,42 @@ public void RetrieveSolutionImportResultAsyncTest()
754753
return;
755754
}
756755

756+
// import solution without async
757757
client.ImportSolution(Path.Combine("TestData", "TestSolution_1_0_0_1.zip"), out var importId);
758758

759+
// Response doesn't include formatted results
760+
var resWithoutFormatted = client.RetrieveSolutionImportResultAsync(importId);
761+
resWithoutFormatted.Should().NotBeNull();
762+
763+
// Response include formatted results
764+
var resWithFormatted = client.RetrieveSolutionImportResultAsync(importId, true);
765+
resWithFormatted.Should().NotBeNull();
766+
resWithFormatted.FormattedResults.Should().NotBeEmpty();
767+
}
768+
769+
[SkippableConnectionTest]
770+
[Trait("Category", "Live Connect Required")]
771+
public void RetrieveSolutionImportResultAsyncTestWithAsyncImport()
772+
{
773+
var client = CreateServiceClient();
774+
if (!Utilities.FeatureVersionMinimums.IsFeatureValidForEnviroment(client._connectionSvc?.OrganizationVersion, Utilities.FeatureVersionMinimums.AllowRetrieveSolutionImportResult))
775+
{
776+
// Not supported on this version of Dataverse
777+
client._logEntry.Log($"RetrieveSolutionImportResultAsync request is calling RetrieveSolutionImportResult API. This request requires Dataverse version {Utilities.FeatureVersionMinimums.AllowRetrieveSolutionImportResult.ToString()} or above. The current Dataverse version is {client._connectionSvc?.OrganizationVersion}. This request cannot be made", TraceEventType.Warning);
778+
return;
779+
}
780+
// import solution with async
781+
client.ImportSolutionAsync(Path.Combine("TestData", "TestSolution_1_0_0_1.zip"), out var asyncImportId);
782+
759783
// Wait a little bit because solution might not be immediately available
760784
System.Threading.Thread.Sleep(30000);
761785

762786
// Response doesn't include formatted results
763-
var resWithoutFormatted = client.RetrieveSolutionImportResultAsync(importId);
787+
var resWithoutFormatted = client.RetrieveSolutionImportResultAsync(asyncImportId);
764788
resWithoutFormatted.Should().NotBeNull();
765789

766790
// Response include formatted results
767-
var resWithFormatted = client.RetrieveSolutionImportResultAsync(importId, true);
791+
var resWithFormatted = client.RetrieveSolutionImportResultAsync(asyncImportId, true);
768792
resWithFormatted.Should().NotBeNull();
769793
resWithFormatted.FormattedResults.Should().NotBeEmpty();
770794
}

src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.Dynamics.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<projectUrl>https://github.com/microsoft/PowerPlatform-DataverseServiceClient</projectUrl>
1010
<icon>images\Dataverse.128x128.png</icon>
1111
<requireLicenseAcceptance>true</requireLicenseAcceptance>
12-
<description>This package contains the .net core ServiceClient Dynamics Extensions. Used to connect to Microsoft Dataverse. This Package has been authored by the Microsoft Dataverse SDK team.</description>
13-
<summary>ServiceClient and supporting libraries for use in building client applications to interact with the Dataverse</summary>
12+
<description>This package contains a set of Dynamics 365 specific extensions, used with the Dataverse ServiceClient. This Package has been authored by the Microsoft Dataverse SDK team.</description>
13+
<summary>This package contains a set of Dynamics 365 specific extensions, used with the Dataverse ServiceClient.</summary>
1414
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
1515
<tags>Dynamics CommonDataService CDS PowerApps PowerPlatform ServiceClient Dataverse</tags>
1616
<dependencies>

src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.ReleaseNotes.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ Notice:
77
Note: Only AD on FullFramework, OAuth, Certificate, ClientSecret Authentication types are supported at this time.
88

99
++CURRENTRELEASEID++
10+
Refactored CurrentAccessToken property to avoid async call.
11+
Fix for min version of default client, pre-connection so it is recognized by features that require 9.0 or greater.
12+
Fix for notification of unsupported features when not 'breaking' to alert as 'warnings' in log vs information.
13+
Dependency changes:
14+
Microsoft.Rest.Client moved to 2.3.24 due to CVE-2022-26907.
15+
16+
17+
1.1.9:
1018
REMOVED .net 3.1 and .net 5 support as they are out of support frameworks.
1119
Added new DiscoverOnlineOrganizationsAsync which supports CancellationToken
1220
Added new RetrieveSolutionImportResultAsync for retrieving solution import result from Dataverse

src/nuspecs/Microsoft.PowerPlatform.Dataverse.Client.nuspec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<dependency id="Microsoft.Extensions.Caching.Memory" version="3.1.8" exclude="Build,Analyzers" />
2222
<dependency id="Microsoft.Identity.Client" version="4.35.1" exclude="Build,Analyzers" />
2323
<dependency id="Microsoft.Identity.Client.Extensions.Msal" version="2.18.9" exclude="Build,Analyzers" />
24-
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.20" exclude="Build,Analyzers" />
24+
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.24" exclude="Build,Analyzers" />
2525
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
2626
<dependency id="System.Text.Json" version="6.0.7" exclude="Build,Analyzers" />
2727
</group>
@@ -32,7 +32,7 @@
3232
<dependency id="Microsoft.Extensions.Caching.Memory" version="3.1.8" exclude="Build,Analyzers" />
3333
<dependency id="Microsoft.Identity.Client" version="4.35.1" exclude="Build,Analyzers" />
3434
<dependency id="Microsoft.Identity.Client.Extensions.Msal" version="2.18.9" exclude="Build,Analyzers" />
35-
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.20" exclude="Build,Analyzers" />
35+
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.24" exclude="Build,Analyzers" />
3636
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
3737
<dependency id="System.Text.Json" version="6.0.7" exclude="Build,Analyzers" />
3838
</group>
@@ -43,7 +43,7 @@
4343
<dependency id="Microsoft.Extensions.Caching.Memory" version="3.1.8" exclude="Build,Analyzers" />
4444
<dependency id="Microsoft.Identity.Client" version="4.35.1" exclude="Build,Analyzers" />
4545
<dependency id="Microsoft.Identity.Client.Extensions.Msal" version="2.18.9" exclude="Build,Analyzers" />
46-
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.20" exclude="Build,Analyzers" />
46+
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.24" exclude="Build,Analyzers" />
4747
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
4848
<dependency id="System.Text.Json" version="6.0.7" exclude="Build,Analyzers" />
4949
</group>
@@ -67,14 +67,15 @@
6767
<dependency id="Microsoft.Extensions.Caching.Memory" version="3.1.8" exclude="Build,Analyzers" />
6868
<dependency id="Microsoft.Identity.Client" version="4.35.1" exclude="Build,Analyzers" />
6969
<dependency id="Microsoft.Identity.Client.Extensions.Msal" version="2.18.9" exclude="Build,Analyzers" />
70-
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.20" exclude="Build,Analyzers" />
70+
<dependency id="Microsoft.Rest.ClientRuntime" version="2.3.24" exclude="Build,Analyzers" />
7171
<dependency id="Microsoft.VisualBasic" version="10.3.0" exclude="Build,Analyzers" />
7272
<dependency id="Newtonsoft.Json" version="13.0.1" exclude="Build,Analyzers" />
7373
<dependency id="System.Configuration.ConfigurationManager" version="4.7.0" exclude="Build,Analyzers" />
7474
<dependency id="System.Runtime.Caching" version="4.7.0" exclude="Build,Analyzers" />
7575
<dependency id="System.Security.Cryptography.Algorithms" version="4.3.1" exclude="Build,Analyzers" />
7676
<dependency id="System.Security.Cryptography.ProtectedData" version="4.7.0" exclude="Build,Analyzers" />
7777
<dependency id="System.Security.Cryptography.Xml" version="6.0.1" exclude="Build,Analyzers" /> <!-- Added for CVE-2022-34716 and CVE-2021-24112 -->
78+
<dependency id="System.Security.Cryptography.Pkcs" version="6.0.3" exclude="Build,Analyzers" /> <!-- Added for CVE-2023-29331 -->
7879
<dependency id="System.Drawing.Common" version="5.0.3" exclude="Build,Analyzers"/> <!-- explict add to deal with CVE-2021-24112 -->
7980
</group>
8081
</dependencies>

0 commit comments

Comments
 (0)