|
4 | 4 | using System; |
5 | 5 | using System.Collections.Generic; |
6 | 6 | using System.ComponentModel; |
7 | | -using System.Security.Cryptography; |
8 | | -using System.Security.Cryptography.X509Certificates; |
9 | | -using System.Text; |
10 | 7 | using System.Threading; |
11 | 8 | using System.Threading.Tasks; |
12 | 9 | using Microsoft.Identity.Client.ApiConfig.Executors; |
|
15 | 12 | using Microsoft.Identity.Client.Extensibility; |
16 | 13 | using Microsoft.Identity.Client.Internal; |
17 | 14 | using Microsoft.Identity.Client.Internal.ClientCredential; |
18 | | -using Microsoft.Identity.Client.ManagedIdentity.V2; |
19 | 15 | using Microsoft.Identity.Client.OAuth2; |
| 16 | +using Microsoft.Identity.Client.PlatformsCommon.Shared; |
20 | 17 | using Microsoft.Identity.Client.TelemetryCore.Internal.Events; |
21 | | -using Microsoft.Identity.Client.Utils; |
22 | 18 |
|
23 | 19 | namespace Microsoft.Identity.Client |
24 | 20 | { |
@@ -100,14 +96,25 @@ public AcquireTokenForClientParameterBuilder WithSendX5C(bool withSendX5C) |
100 | 96 | /// <returns>The current instance of <see cref="AcquireTokenForClientParameterBuilder"/> to enable method chaining.</returns> |
101 | 97 | public AcquireTokenForClientParameterBuilder WithMtlsProofOfPossession() |
102 | 98 | { |
103 | | -#if NET462 |
104 | 99 | if (ServiceBundle.Config.IsManagedIdentity) |
105 | 100 | { |
106 | | - throw new MsalClientException( |
107 | | - MsalError.MtlsNotSupportedForManagedIdentity, |
108 | | - MsalErrorMessage.MtlsNotSupportedForManagedIdentityMessage); |
109 | | - } |
| 101 | + void MtlsNotSupportedForManagedIdentity(string message) |
| 102 | + { |
| 103 | + throw new MsalClientException( |
| 104 | + MsalError.MtlsNotSupportedForManagedIdentity, |
| 105 | + message); |
| 106 | + } |
| 107 | + |
| 108 | + if (!DesktopOsHelper.IsWindows()) |
| 109 | + { |
| 110 | + MtlsNotSupportedForManagedIdentity(MsalErrorMessage.MtlsNotSupportedForNonWindowsMessage); |
| 111 | + } |
| 112 | + |
| 113 | +#if NET462 |
| 114 | + MtlsNotSupportedForManagedIdentity(MsalErrorMessage.MtlsNotSupportedForManagedIdentityMessage); |
110 | 115 | #endif |
| 116 | + } |
| 117 | + |
111 | 118 | if (ServiceBundle.Config.ClientCredential is CertificateClientCredential certificateCredential) |
112 | 119 | { |
113 | 120 | if (certificateCredential.Certificate == null) |
|
0 commit comments