public async Task <IReadOnlyList <IAccount> > GetAccountsAsync( string clientID, string redirectUri, AuthorityInfo authorityInfo, ICacheSessionManager cacheSessionManager, IInstanceDiscoveryManager instanceDiscoveryManager) { using (_logger.LogMethodDuration()) { if (!_wamOptions.ListWindowsWorkAndSchoolAccounts) { _logger.Info("WAM::FindAllAccountsAsync returning no accounts due to configuration option"); return(Array.Empty <IAccount>()); } if ( !ApiInformation.IsMethodPresent( "Windows.Security.Authentication.Web.Core.WebAuthenticationCoreManager", "FindAllAccountsAsync")) { _logger.Info("WAM::FindAllAccountsAsync method does not exist. Returning 0 broker accounts. "); return(Array.Empty <IAccount>()); } var aadAccounts = await _aadPlugin.GetAccountsAsync(clientID, authorityInfo, cacheSessionManager, instanceDiscoveryManager).ConfigureAwait(false); var msaAccounts = await _msaPlugin.GetAccountsAsync(clientID, authorityInfo, cacheSessionManager, instanceDiscoveryManager).ConfigureAwait(false); return((aadAccounts.Concat(msaAccounts)).ToList()); } }
public async Task GetAccounts_NoAccounts_Async() { // Arrange using (MockHttpAndServiceBundle harness = CreateTestHarness()) { // Act var accounts = await _aadPlugin.GetAccountsAsync( TestConstants.ClientId, AuthorityInfo.FromAuthorityUri(TestConstants.AuthorityCommonTenant, true), _cacheSessionManager, _instanceDiscoveryManager).ConfigureAwait(false); // Assert Assert.AreEqual(0, accounts.Count()); } }
public async Task <IEnumerable <IAccount> > GetAccountsAsync(string clientID, string redirectUri) { using (_logger.LogMethodDuration()) { if (!ApiInformation.IsMethodPresent( "Windows.Security.Authentication.Web.Core.WebAuthenticationCoreManager", "FindAllAccountsAsync")) { _logger.Info("WAM::FindAllAccountsAsync method does not exist. Returning 0 broker accounts. "); return(Enumerable.Empty <IAccount>()); } var aadAccounts = await _aadPlugin.GetAccountsAsync(clientID).ConfigureAwait(false); var msaAccounts = await _msaPlugin.GetAccountsAsync(clientID).ConfigureAwait(false); return(aadAccounts.Concat(msaAccounts)); } }