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; } }
public bool TryGetValue(string key, out Authority authority) { return(_validatedAuthorities.TryGetValue(key, out authority)); }
public bool TryAddValue(string key, Authority authority) { return(_validatedAuthorities.TryAdd(key, authority)); }