|  |  | 1 |  | // Copyright (c) Microsoft Corporation. All rights reserved. | 
|  |  | 2 |  | // Licensed under the MIT License. | 
|  |  | 3 |  |  | 
|  |  | 4 |  | using Microsoft.Extensions.Options; | 
|  |  | 5 |  |  | 
|  |  | 6 |  | namespace Microsoft.Extensions.Azure | 
|  |  | 7 |  | { | 
|  |  | 8 |  |     internal class DefaultCredentialClientOptionsSetup<T> : IConfigureNamedOptions<AzureClientCredentialOptions<T>> | 
|  |  | 9 |  |     { | 
|  |  | 10 |  |         private readonly IOptions<AzureClientsGlobalOptions> _defaultOptions; | 
|  |  | 11 |  |  | 
|  | 46 | 12 |  |         public DefaultCredentialClientOptionsSetup(IOptions<AzureClientsGlobalOptions> defaultOptions) | 
|  |  | 13 |  |         { | 
|  | 46 | 14 |  |             _defaultOptions = defaultOptions; | 
|  | 46 | 15 |  |         } | 
|  |  | 16 |  |  | 
|  |  | 17 |  |         public void Configure(AzureClientCredentialOptions<T> options) | 
|  |  | 18 |  |         { | 
|  | 46 | 19 |  |             if (options.CredentialFactory == null) | 
|  |  | 20 |  |             { | 
|  | 46 | 21 |  |                 options.CredentialFactory = _defaultOptions.Value.CredentialFactory; | 
|  |  | 22 |  |             } | 
|  | 46 | 23 |  |         } | 
|  |  | 24 |  |  | 
|  |  | 25 |  |         public void Configure(string name, AzureClientCredentialOptions<T> options) | 
|  |  | 26 |  |         { | 
|  | 46 | 27 |  |             Configure(options); | 
|  | 46 | 28 |  |         } | 
|  |  | 29 |  |     } | 
|  |  | 30 |  | } |