public static async Task <List <FlattenedAuthorizationCodeHandle> > InsertTestData_AuthorizationCode(int count = 1) { var dao = new IdentityServer3CassandraDao(); await dao.EstablishConnectionAsync(); IClientStore clientStore = new ClientStore(); var insertTokens = await CassandraTestHelper.InsertTestData_Tokens(count); // only add one client var clientId = insertTokens[0].ClientId; var clientRecord = await clientStore.FindClientByIdAsync(clientId); List <FlattenedAuthorizationCodeHandle> result = new List <FlattenedAuthorizationCodeHandle>(); int i = 0; foreach (var insertToken in insertTokens) { var claimIdentityRecords = new List <ClaimIdentityRecord>() { new ClaimIdentityRecord() { AuthenticationType = Constants.PrimaryAuthenticationType, ClaimTypeRecords = new List <ClaimTypeRecord>() { new ClaimTypeRecord() { Type = Constants.ClaimTypes.Subject, Value = "Value:" + i, ValueType = "VALUETYPE:" + i } } } }; FlattenedAuthorizationCodeHandle handle = new FlattenedAuthorizationCodeHandle { ClientId = clientId, SubjectId = insertToken.SubjectId, Expires = DateTimeOffset.UtcNow.AddMinutes(5), CreationTime = DateTimeOffset.UtcNow, IsOpenId = true, RedirectUri = "REDIRECTURI/" + i, WasConsentShown = true, Nonce = "NONCE:" + i, ClaimIdentityRecords = new FlattenedAuthorizationCodeHandle().SerializeClaimsIdentityRecords(claimIdentityRecords), RequestedScopes = new FlattenedAuthorizationCodeHandle().SerializeRequestScopes(clientRecord.AllowedScopes), Key = Guid.NewGuid().ToString() }; ++i; result.Add(handle); } await dao.CreateManyAuthorizationCodeHandleAsync(result); return(result); }