private static IList <SecurityToken> GetAndVerifyJsonWebKeys(string uri)
        {
            Microsoft.IdentityModel.Protocols.JsonWebKey key = new IdentityModel.Protocols.JsonWebKey();
            Microsoft.IdentityModel.Protocols.OpenIdConnectConfiguration config;
            System.Threading.CancellationTokenSource src = new System.Threading.CancellationTokenSource();
            config = Microsoft.IdentityModel.Protocols.OpenIdConnectConfigurationRetriever.GetAsync(uri, src.Token).Result;
            JsonWebKeySet keyset = config.JsonWebKeySet;

            Assert.IsNotNull(keyset);
            Assert.IsNotNull(keyset.GetSigningTokens());
            return(keyset.GetSigningTokens());
        }
        private void GetSigningTokens(string webKeySetString, List <SecurityToken> expectedTokens, ExpectedException expectedException)
        {
            JsonWebKeySet webKeySet = new JsonWebKeySet(webKeySetString);

            try
            {
                IList <SecurityToken> tokens = webKeySet.GetSigningTokens();
                expectedException.ProcessNoException();
                if (expectedTokens != null)
                {
                    Assert.IsTrue(IdentityComparer.AreEqual <IEnumerable <SecurityToken> >(tokens, expectedTokens));
                }
            }
            catch (Exception ex)
            {
                expectedException.ProcessException(ex);
            }
        }