| | 1 | | using Microsoft.Rest; |
| | 2 | | using System.Linq; |
| | 3 | | using System.Net.Http; |
| | 4 | | using System.Security.Cryptography.X509Certificates; |
| | 5 | |
|
| | 6 | | namespace Microsoft.Azure.Batch.IntegrationTestCommon.Tests.Helpers |
| | 7 | | { |
| | 8 | | #if !FullNetFx |
| | 9 | | /// <summary> |
| | 10 | | /// Work around due being unavailable in .netcore |
| | 11 | | /// </summary> |
| | 12 | | class CertificateCredentialsNetCore : ServiceClientCredentials |
| | 13 | | { |
| | 14 | | private X509Certificate2 cert; |
| 0 | 15 | | public CertificateCredentialsNetCore(X509Certificate2 cert) |
| | 16 | | { |
| 0 | 17 | | this.cert = cert; |
| 0 | 18 | | } |
| | 19 | | public override void InitializeServiceClient<T>(ServiceClient<T> client) |
| | 20 | | { |
| 0 | 21 | | HttpClientHandler handler = client.HttpMessageHandlers.FirstOrDefault(h => h is HttpClientHandler) as HttpCl |
| 0 | 22 | | handler.ClientCertificates.Add(this.cert); |
| 0 | 23 | | } |
| | 24 | | } |
| | 25 | | #endif |
| | 26 | | } |