public async Task GetAll_EmptyDb_ReturnsEmptySet() { m_mockPublicKeyDataProvider .Setup(kp => kp.GetAllAsync()) .ReturnsAsync(Enumerable.Empty <JsonWebKey>()); IEnumerable <JsonWebKey> result = await m_publicKeyDataProvider .GetAllAsync() .SafeAsync(); Assert.IsEmpty(result); }
public async Task ProvisionAccessTokenAsync_AssertionTokenIsSigned() { var claims = new List <Claim> { new Claim(Constants.Claims.ISSUER, TestData.ISSUER), new Claim(Constants.Claims.TENANT_ID, TestData.TENANT_ID.ToString()), new Claim(Constants.Claims.USER_ID, TestData.USER) }; var scopes = new Scope[] { }; await m_accessTokenProvider .ProvisionAccessTokenAsync(claims, scopes) .ConfigureAwait(false); var publicKeys = (await m_publicKeyDataProvider.GetAllAsync().ConfigureAwait(false)).ToList(); string expectedKeyId = publicKeys.First().Id.ToString(); string actualKeyId = m_actualAssertion.Header.Kid; Assert.AreEqual(1, publicKeys.Count); Assert.AreEqual(expectedKeyId, actualKeyId); AssertClaimEquals(m_actualAssertion, Constants.Claims.ISSUER, TestData.ISSUER); AssertClaimEquals(m_actualAssertion, Constants.Claims.TENANT_ID, TestData.TENANT_ID.ToString()); AssertClaimEquals(m_actualAssertion, Constants.Claims.USER_ID, TestData.USER); }
async Task <IEnumerable <JsonWebKey> > IPublicKeyDataProvider.GetAllAsync() { IEnumerable <JsonWebKey> keys = await m_inner .GetAllAsync() .SafeAsync(); keys = await Task .WhenAll( keys.Select( key => KeyExpirationHelper(key)).ToArray() ) .SafeAsync(); keys = keys .Where(key => key != null) .ToArray(); return(keys); }
public async Task GetAll_NoKeys_Empty() { var keys = await m_publicKeyDataProvider.GetAllAsync().SafeAsync(); Assert.IsEmpty(keys); }
public async Task GetAll_NoKeys_Empty() { var keys = await m_publicKeyDataProvider.GetAllAsync().ConfigureAwait(false); Assert.IsEmpty(keys); }