public async Task RunInstanceDiscoveryAndValidationAsync()
        {
            if (!_instanceDiscoveryAndValidationExecuted)
            {
                // This will make a network call unless instance discovery is cached, but this OK
                // GetAccounts and AcquireTokenSilent do not need this
                _metadata = await
                            _requestContext.ServiceBundle.InstanceDiscoveryManager.GetMetadataEntryAsync(
                    _initialAuthority.AuthorityInfo,
                    _requestContext)
                            .ConfigureAwait(false);

                _currentAuthority = Authority.CreateAuthorityWithEnvironment(
                    _initialAuthority.AuthorityInfo,
                    _metadata.PreferredNetwork);

                // We can only validate the initial environment, not regional environments
                await ValidateAuthorityAsync(_initialAuthority).ConfigureAwait(false);

                _instanceDiscoveryAndValidationExecuted = true;
            }
        }
예제 #2
0
 public bool TryGetValue(string key, out Authority authority)
 {
     return(_validatedAuthorities.TryGetValue(key, out authority));
 }
예제 #3
0
 public bool TryAddValue(string key, Authority authority)
 {
     return(_validatedAuthorities.TryAdd(key, authority));
 }