|
10 | 10 | using System.Threading.Tasks;
|
11 | 11 | using Azure.Core;
|
12 | 12 | using Azure.Identity;
|
| 13 | +using Microsoft.Data.Common; |
13 | 14 | using Microsoft.Extensions.Caching.Memory;
|
14 | 15 | using Microsoft.Identity.Client;
|
15 | 16 | using Microsoft.Identity.Client.Extensibility;
|
@@ -542,31 +543,24 @@ private static bool AreEqual(byte[] a1, byte[] a2)
|
542 | 543 |
|
543 | 544 | private IPublicClientApplication CreateClientAppInstance(PublicClientAppKey publicClientAppKey)
|
544 | 545 | {
|
545 |
| - IPublicClientApplication publicClientApplication; |
546 |
| - |
547 |
| -#if NETFRAMEWORK |
548 |
| - if (_iWin32WindowFunc != null) |
549 |
| - { |
550 |
| - publicClientApplication = PublicClientApplicationBuilder.Create(publicClientAppKey._applicationClientId) |
551 |
| - .WithAuthority(publicClientAppKey._authority) |
552 |
| - .WithClientName(Common.DbConnectionStringDefaults.ApplicationName) |
553 |
| - .WithClientVersion(Common.ADP.GetAssemblyVersion().ToString()) |
554 |
| - .WithRedirectUri(publicClientAppKey._redirectUri) |
555 |
| - .WithParentActivityOrWindow(_iWin32WindowFunc) |
556 |
| - .Build(); |
557 |
| - } |
558 |
| - else |
559 |
| -#endif |
| 546 | + PublicClientApplicationBuilder builder = PublicClientApplicationBuilder |
| 547 | + .CreateWithApplicationOptions(new PublicClientApplicationOptions |
| 548 | + { |
| 549 | + ClientId = publicClientAppKey._applicationClientId, |
| 550 | + ClientName = DbConnectionStringDefaults.ApplicationName, |
| 551 | + ClientVersion = ADP.GetAssemblyVersion().ToString(), |
| 552 | + RedirectUri = publicClientAppKey._redirectUri, |
| 553 | + }) |
| 554 | + .WithAuthority(publicClientAppKey._authority); |
| 555 | + |
| 556 | + #if NETFRAMEWORK |
| 557 | + if (_iWin32WindowFunc is not null) |
560 | 558 | {
|
561 |
| - publicClientApplication = PublicClientApplicationBuilder.Create(publicClientAppKey._applicationClientId) |
562 |
| - .WithAuthority(publicClientAppKey._authority) |
563 |
| - .WithClientName(Common.DbConnectionStringDefaults.ApplicationName) |
564 |
| - .WithClientVersion(Common.ADP.GetAssemblyVersion().ToString()) |
565 |
| - .WithRedirectUri(publicClientAppKey._redirectUri) |
566 |
| - .Build(); |
| 559 | + builder.WithParentActivityOrWindow(_iWin32WindowFunc); |
567 | 560 | }
|
| 561 | + #endif |
568 | 562 |
|
569 |
| - return publicClientApplication; |
| 563 | + return builder.Build(); |
570 | 564 | }
|
571 | 565 |
|
572 | 566 | private static TokenCredentialData CreateTokenCredentialInstance(TokenCredentialKey tokenCredentialKey, string secret)
|
|
0 commit comments