Esempio n. 1
0
        public async Task TestRevokeAsync()
        {
            var store         = new ConsentStore();
            var insertClients = await CassandraTestHelper.InsertTestData_Clients(2);

            // we are going to associate a bunch of tokens to this one client
            var subject = Guid.NewGuid().ToString();

            foreach (var client in insertClients)
            {
                await CassandraTestHelper.InsertTestData_Consents(client.ClientId, subject, 1);
            }

            var result = await store.LoadAllAsync(subject);

            Assert.AreEqual(2, result.Count());

            foreach (var client in insertClients)
            {
                await store.RevokeAsync(subject, client.ClientId);
            }
            result = await store.LoadAllAsync(subject);

            Assert.AreEqual(0, result.Count());
        }
Esempio n. 2
0
        public async Task TestCreateTokenHandleAsync()
        {
            var dao = new IdentityServer3CassandraDao();
            await dao.EstablishConnectionAsync();

            var store = new ConsentStore();

            var insert = await CassandraTestHelper.InsertTestData_Consents(1);

            var flat = insert[0];
            FlattenedConsentRecord fcr = new FlattenedConsentRecord(flat);
            var result = await dao.FindConsentByIdAsync(fcr.Id);

            Assert.AreEqual(result.ClientId, flat.ClientId);
            Assert.AreEqual(result.Subject, flat.Subject);

            result = await store.LoadAsync(flat.Subject, flat.ClientId);

            Assert.AreEqual(result.ClientId, flat.ClientId);
            Assert.AreEqual(result.Subject, flat.Subject);
        }