Пример #1
0
        public async Task AddClientPropertyAsync()
        {
            IClientRepository clientRepository = new ClientDapperRepository(_configuration);

            //Generate random new client without id
            var client = ClientMock.GenerateRandomClient();

            //Add new client
            var clientId = await clientRepository.AddClientAsync(client);

            //Get new client
            var clientEntity = await clientRepository.GetClientAsync(clientId);

            //Assert new client
            clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id)
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedGrantTypes\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "RedirectUris\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "PostLogoutRedirectUris\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedScopes\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "IdentityProviderRestrictions\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedCorsOrigins\\[.+\\].Id")));

            //Generate random new Client property
            var clientProperty = ClientMock.GenerateRandomClientProperty();

            //Add new client property
            var clientPropertyId = await clientRepository.AddClientPropertyAsync(clientEntity.Id, clientProperty);

            //Get new client property
            var newClientProperty = await clientRepository.GetClientPropertyAsync(clientPropertyId);

            newClientProperty.ShouldBeEquivalentTo(clientProperty, options => options.Excluding(o => o.Id).Excluding(x => x.Client));
        }
Пример #2
0
        public async Task RemoveClientAsync()
        {
            IClientRepository clientRepository = new ClientDapperRepository(_configuration);

            //Generate random new client without id
            var client = ClientMock.GenerateRandomClient();

            //Add new client
            var clientId = await clientRepository.AddClientAsync(client);

            //Get new client
            var clientEntity = await clientRepository.GetClientAsync(clientId);

            //Assert new client
            clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id)
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedGrantTypes\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "RedirectUris\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "PostLogoutRedirectUris\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedScopes\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "IdentityProviderRestrictions\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedCorsOrigins\\[.+\\].Id")));

            //Remove client
            await clientRepository.RemoveClientAsync(clientEntity);

            //Try Get Removed client
            var removeClientEntity = await clientRepository.GetClientAsync(clientId);

            //Assert removed client - it might be null
            removeClientEntity.Should().BeNull();
        }
        public async Task AddClientPropertyAsync()
        {
            using (var context = new AdminDbContext(_dbContextOptions, _storeOptions, _operationalStore))
            {
                IClientRepository clientRepository = new ClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                clientEntity.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id));

                //Generate random new Client property
                var clientProperty = ClientMock.GenerateRandomClientProperty(0);

                //Add new client property
                await clientRepository.AddClientPropertyAsync(clientEntity.Id, clientProperty);

                //Get new client property
                var newClientProperty = await context.ClientProperties.Where(x => x.Id == clientProperty.Id)
                                        .SingleOrDefaultAsync();

                newClientProperty.Should().BeEquivalentTo(clientProperty,
                                                          options => options.Excluding(o => o.Id).Excluding(x => x.Client));
            }
        }
Пример #4
0
        public async Task UpdateClient()
        {
            //Get Services
            var serviceProvider = GetServices();
            var dbContext       = serviceProvider.GetRequiredService <IdentityServerConfigurationDbContext>();
            var clientService   = serviceProvider.GetRequiredService <IClientService>();

            // Get controller
            var controller = PrepareConfigurationController(serviceProvider);

            var clientToAdd = ClientMock.GenerateRandomClient(0);
            await dbContext.Clients.AddAsync(clientToAdd);

            await dbContext.SaveChangesAsync();

            dbContext.Entry(clientToAdd).State = EntityState.Detached;

            var clientDto = ClientDtoMock.GenerateRandomClient(clientToAdd.Id);
            var result    = await controller.Client(clientDto);

            // Assert
            var viewResult = Assert.IsType <RedirectToActionResult>(result);

            viewResult.ActionName.Should().Be("Client");

            var client = await dbContext.Clients.Where(x => x.ClientId == clientDto.ClientId).SingleOrDefaultAsync();

            var adddedClient = await clientService.GetClientAsync(client.Id);

            clientDto.Should().BeEquivalentTo(adddedClient, opts => opts.Excluding(x => x.Id)
                                              .Excluding(x => x.AccessTokenTypes)
                                              .Excluding(x => x.ProtocolTypes)
                                              .Excluding(x => x.RefreshTokenExpirations)
                                              .Excluding(x => x.RefreshTokenUsages));
        }
        public async Task AddClientClaimAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                var clientRepository = GetClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                ClientAssert(clientEntity, client);

                //Generate random new Client Claim
                var clientClaim = ClientMock.GenerateRandomClientClaim(0);

                //Add new client claim
                await clientRepository.AddClientClaimAsync(clientEntity.Id, clientClaim);

                //Get new client claim
                var newClientClaim =
                    await context.ClientClaims.Where(x => x.Id == clientClaim.Id).SingleOrDefaultAsync();

                newClientClaim.Should().BeEquivalentTo(clientClaim,
                                                       options => options.Excluding(o => o.Id).Excluding(x => x.Client));
            }
        }
        public async Task RemoveClientAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                var clientRepository = GetClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await context.Clients.Where(x => x.Id == client.Id).SingleAsync();

                //Assert new client
                clientEntity.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id));

                //Detached the added item
                context.Entry(clientEntity).State = EntityState.Detached;

                //Remove client
                await clientRepository.RemoveClientAsync(clientEntity);

                //Try Get Removed client
                var removeClientEntity = await context.Clients.Where(x => x.Id == clientEntity.Id)
                                         .SingleOrDefaultAsync();

                //Assert removed client - it might be null
                removeClientEntity.Should().BeNull();
            }
        }
        public async Task UpdateClientAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                var clientRepository = GetClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await context.Clients.Where(x => x.Id == client.Id).SingleAsync();

                //Assert new client
                clientEntity.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id));

                //Detached the added item
                context.Entry(clientEntity).State = EntityState.Detached;

                //Generete new client with added item id
                var updatedClient = ClientMock.GenerateRandomClient(clientEntity.Id);

                //Update client
                await clientRepository.UpdateClientAsync(updatedClient);

                //Get updated client
                var updatedClientEntity =
                    await context.Clients.Where(x => x.Id == updatedClient.Id).SingleAsync();

                //Assert updated client
                updatedClientEntity.Should().BeEquivalentTo(updatedClient);
            }
        }
Пример #8
0
        public void CanMapClientToModel()
        {
            //Generate entity
            var client = ClientMock.GenerateRandomClient(0);

            //Try map to DTO
            var clientDto = client.ToModel();

            //Asert
            clientDto.Should().NotBeNull();

            client.ShouldBeEquivalentTo(clientDto, options =>
                                        options.Excluding(o => o.AllowedCorsOrigins)
                                        .Excluding(o => o.RedirectUris)
                                        .Excluding(o => o.PostLogoutRedirectUris)
                                        .Excluding(o => o.AllowedGrantTypes)
                                        .Excluding(o => o.AllowedScopes)
                                        .Excluding(o => o.Created)
                                        .Excluding(o => o.AllowedIdentityTokenSigningAlgorithms)
                                        .Excluding(o => o.IdentityProviderRestrictions));

            //Assert collection
            client.AllowedCorsOrigins.Select(x => x.Origin).ShouldBeEquivalentTo(clientDto.AllowedCorsOrigins);
            client.RedirectUris.Select(x => x.RedirectUri).ShouldBeEquivalentTo(clientDto.RedirectUris);
            client.PostLogoutRedirectUris.Select(x => x.PostLogoutRedirectUri).ShouldBeEquivalentTo(clientDto.PostLogoutRedirectUris);
            client.AllowedGrantTypes.Select(x => x.GrantType).ShouldBeEquivalentTo(clientDto.AllowedGrantTypes);
            client.AllowedScopes.Select(x => x.Scope).ShouldBeEquivalentTo(clientDto.AllowedScopes);
            client.IdentityProviderRestrictions.Select(x => x.Provider).ShouldBeEquivalentTo(clientDto.IdentityProviderRestrictions);
            var allowedAlgList = AllowedSigningAlgorithmsConverter.Converter.Convert(client.AllowedIdentityTokenSigningAlgorithms, null);

            allowedAlgList.ShouldBeEquivalentTo(clientDto.AllowedIdentityTokenSigningAlgorithms);
        }
        public async Task GetClientSecretAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                var clientRepository = GetClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                ClientAssert(clientEntity, client);

                //Generate random new Client Secret
                var clientSecret = ClientMock.GenerateRandomClientSecret(0);

                //Add new client secret
                await clientRepository.AddClientSecretAsync(clientEntity.Id, clientSecret);

                //Get new client secret
                var newSecret = await clientRepository.GetClientSecretAsync(clientSecret.Id);

                newSecret.Should().BeEquivalentTo(clientSecret,
                                                  options => options.Excluding(o => o.Id).Excluding(x => x.Client));
            }
        }
        public async Task GetClientClaimAsync()
        {
            using (var context = new AdminDbContext(_dbContextOptions, _storeOptions, _operationalStore))
            {
                IClientRepository clientRepository = new ClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                clientEntity.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id));

                //Generate random client claim
                var clientClaim = ClientMock.GenerateRandomClientClaim(0);

                //Add new client claim
                await clientRepository.AddClientClaimAsync(clientEntity.Id, clientClaim);

                //Get new client claim
                var newClientClaim = await clientRepository.GetClientClaimAsync(clientClaim.Id);

                newClientClaim.Should().BeEquivalentTo(clientClaim,
                                                       options => options.Excluding(o => o.Id).Excluding(x => x.Client));
            }
        }
Пример #11
0
        public async Task CloneClientWithoutScopesAsync()
        {
            using (var context = new AdminDbContext(_dbContextOptions, _storeOptions, _operationalStore))
            {
                //Generate random new client
                var client = ClientMock.GenerateRandomClient(0, generateClaims: true, generateProperties: true, generateSecrets: true);

                IClientRepository clientRepository = new ClientRepository(context);

                //Add new client
                client.ClientSecrets = null;
                await clientRepository.AddClientAsync(client);

                var clientToClone = await context.Clients.Where(x => x.Id == client.Id).SingleOrDefaultAsync();

                //Try clone it
                var clonedClientId = await clientRepository.CloneClientAsync(clientToClone, cloneClientScopes : false);

                var cloneClientEntity = await clientRepository.GetClientAsync(clonedClientId);

                var clientToCompare = await clientRepository.GetClientAsync(clientToClone.Id);

                ClientCloneCompare(cloneClientEntity, clientToCompare, cloneClientScopes: false);
            }
        }
Пример #12
0
        public async Task DeleteClient()
        {
            //Get Services
            var serviceProvider = GetServices();

            var dbContext = serviceProvider.GetRequiredService <IdentityServerConfigurationDbContext>();

            // Get controller
            var controller = PrepareConfigurationController(serviceProvider);
            var client     = ClientMock.GenerateRandomClient(0);
            await dbContext.Clients.AddAsync(client);

            await dbContext.SaveChangesAsync();

            dbContext.Entry(client).State = EntityState.Detached;

            var clientDto = ClientDtoMock.GenerateRandomClient(client.Id);
            var result    = await controller.ClientDelete(clientDto);

            // Assert
            var viewResult = Assert.IsType <RedirectToActionResult>(result);

            viewResult.ActionName.Should().Be("Clients");

            var deletedClient = await dbContext.Clients.Where(x => x.Id == clientDto.Id).SingleOrDefaultAsync();

            deletedClient.Should().BeNull();
        }
Пример #13
0
        private async Task <Client> GenerateClient(IdentityServerConfigurationDbContext dbContext)
        {
            var client = ClientMock.GenerateRandomClient(id: 0);

            await dbContext.Clients.AddAsync(client);

            await dbContext.SaveChangesAsync();

            return(client);
        }
        private async Task <Client> GenerateClient(AdminDbContext dbContext)
        {
            var client = ClientMock.GenerateRandomClient(id: 0);

            await dbContext.Clients.AddAsync(client);

            await dbContext.SaveChangesAsync();

            return(client);
        }
        public async Task AddClientAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                var clientRepository = GetClientRepository(context);

                //Generate random new client
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await context.Clients.Where(x => x.Id == client.Id).SingleAsync();

                //Assert new client
                clientEntity.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id));
            }
        }
        public async Task GetClientAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                var clientRepository = GetClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                ClientAssert(clientEntity, client);
            }
        }
        public async Task GetClientAsync()
        {
            using (var context = new ConfigurationDbContext(_dbContextOptions, _storeOptions, _operationalStore))
            {
                IClientRepository clientRepository = new ClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id));
            }
        }
Пример #18
0
        public async Task DeleteClientSecretAsync()
        {
            IClientRepository clientRepository = new ClientDapperRepository(_configuration);

            //Generate random new client without id
            var client = ClientMock.GenerateRandomClient();

            //Add new client
            var clientId = await clientRepository.AddClientAsync(client);

            //Get new client
            var clientEntity = await clientRepository.GetClientAsync(clientId);

            //Assert new client
            clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id)
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedGrantTypes\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "RedirectUris\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "PostLogoutRedirectUris\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedScopes\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "IdentityProviderRestrictions\\[.+\\].Id"))
                                              .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedCorsOrigins\\[.+\\].Id")));

            //Generate random new Client Secret
            var clientSecret = ClientMock.GenerateRandomClientSecret();

            //Add new client secret
            var clientSecretId = await clientRepository.AddClientSecretAsync(clientEntity.Id, clientSecret);

            //Get new client secret
            var newSecret = await clientRepository.GetClientSecretAsync(clientSecretId);

            //Asert
            newSecret.ShouldBeEquivalentTo(clientSecret, options => options.Excluding(o => o.Id).Excluding(x => x.Client).Excluding(x => x.Expiration));

            //Try delete it
            await clientRepository.DeleteClientSecretAsync(newSecret);

            //Get new client secret
            var deletedSecret = await clientRepository.GetClientSecretAsync(clientSecret.Id);

            //Assert
            deletedSecret.Should().BeNull();
        }
        public async Task DeleteClientClaimAsync()
        {
            using (var context = new AdminDbContext(_dbContextOptions, _storeOptions, _operationalStore))
            {
                IClientRepository clientRepository = new ClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id));

                //Generate random new Client Claim
                var clientClaim = ClientMock.GenerateRandomClientClaim(0);

                //Add new client claim
                await clientRepository.AddClientClaimAsync(clientEntity.Id, clientClaim);

                //Get new client claim
                var newClientClaim =
                    await context.ClientClaims.Where(x => x.Id == clientClaim.Id).SingleOrDefaultAsync();

                //Asert
                newClientClaim.ShouldBeEquivalentTo(clientClaim,
                                                    options => options.Excluding(o => o.Id).Excluding(x => x.Client));

                //Try delete it
                await clientRepository.DeleteClientClaimAsync(newClientClaim);

                //Get new client claim
                var deletedClientClaim =
                    await context.ClientClaims.Where(x => x.Id == clientClaim.Id).SingleOrDefaultAsync();

                //Assert
                deletedClientClaim.Should().BeNull();
            }
        }
        public async Task DeleteClientPropertyAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                var clientRepository = GetClientRepository(context);

                //Generate random new client without id
                var client = ClientMock.GenerateRandomClient(0);

                //Add new client
                await clientRepository.AddClientAsync(client);

                //Get new client
                var clientEntity = await clientRepository.GetClientAsync(client.Id);

                //Assert new client
                ClientAssert(clientEntity, client);

                //Generate random new Client Property
                var clientProperty = ClientMock.GenerateRandomClientProperty(0);

                //Add new client property
                await clientRepository.AddClientPropertyAsync(clientEntity.Id, clientProperty);

                //Get new client property
                var newClientProperties = await context.ClientProperties.Where(x => x.Id == clientProperty.Id)
                                          .SingleOrDefaultAsync();

                //Assert
                newClientProperties.Should().BeEquivalentTo(clientProperty,
                                                            options => options.Excluding(o => o.Id).Excluding(x => x.Client));

                //Try delete it
                await clientRepository.DeleteClientPropertyAsync(newClientProperties);

                //Get new client property
                var deletedClientProperty = await context.ClientProperties.Where(x => x.Id == clientProperty.Id)
                                            .SingleOrDefaultAsync();

                //Assert
                deletedClientProperty.Should().BeNull();
            }
        }
        public void CanMapClientToModel()
        {
            //Generate entity
            var client = ClientMock.GenerateRandomClient(0);

            //Try map to DTO
            var clientDto = client.ToModel();

            //Asert
            clientDto.Should().NotBeNull();

            client.Should().BeEquivalentTo(clientDto, options =>
                                           options.Excluding(o => o.AccessTokenTypes)
                                           .Excluding(o => o.Created)
                                           .Excluding(o => o.AllowedCorsOrigins)
                                           .Excluding(o => o.AllowedCorsOriginsItems)
                                           .Excluding(o => o.AllowedGrantTypes)
                                           .Excluding(o => o.AllowedGrantTypesItems)
                                           .Excluding(o => o.AllowedScopes)
                                           .Excluding(o => o.AllowedScopesItems)
                                           .Excluding(o => o.Claims)
                                           .Excluding(o => o.ClientSecrets)
                                           .Excluding(o => o.ClientType)
                                           .Excluding(o => o.Properties)
                                           .Excluding(o => o.ProtocolTypes)
                                           .Excluding(o => o.PostLogoutRedirectUris)
                                           .Excluding(o => o.PostLogoutRedirectUrisItems)
                                           .Excluding(o => o.RedirectUris)
                                           .Excluding(o => o.RedirectUrisItems)
                                           .Excluding(o => o.RefreshTokenUsages)
                                           .Excluding(o => o.RefreshTokenExpirations)
                                           .Excluding(o => o.IdentityProviderRestrictions)
                                           .Excluding(o => o.IdentityProviderRestrictionsItems));

            //Assert collection
            client.AllowedCorsOrigins.Select(x => x.Origin).Should().BeEquivalentTo(clientDto.AllowedCorsOrigins);
            client.RedirectUris.Select(x => x.RedirectUri).Should().BeEquivalentTo(clientDto.RedirectUris);
            client.PostLogoutRedirectUris.Select(x => x.PostLogoutRedirectUri).Should().BeEquivalentTo(clientDto.PostLogoutRedirectUris);
            client.AllowedGrantTypes.Select(x => x.GrantType).Should().BeEquivalentTo(clientDto.AllowedGrantTypes);
            client.AllowedScopes.Select(x => x.Scope).Should().BeEquivalentTo(clientDto.AllowedScopes);
            client.IdentityProviderRestrictions.Select(x => x.Provider).Should().BeEquivalentTo(clientDto.IdentityProviderRestrictions);
        }
Пример #22
0
        public async Task CloneClientWithoutScopesAsync()
        {
            //Generate random new client
            var client = ClientMock.GenerateRandomClient(0, generateClaims: true, generateProperties: true, generateSecrets: true);

            IClientRepository clientRepository = new ClientDapperRepository(_configuration);

            //Add new client
            var clientId = await clientRepository.AddClientAsync(client);

            var clientToClone = await clientRepository.GetClientAsync(clientId);

            clientToClone.ClientId = $"{clientToClone.ClientId}(Clone))";
            //Try clone it
            var clonedClientId = await clientRepository.CloneClientAsync(clientToClone, cloneClientScopes : false);

            var cloneClientEntity = await clientRepository.GetClientAsync(clonedClientId);

            var clientToCompare = await clientRepository.GetClientAsync(clientToClone.Id);

            ClientCloneCompare(cloneClientEntity, clientToCompare, cloneClientScopes: false);
        }
        public async Task CloneClientWithoutRedirectUrisAsync()
        {
            using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions))
            {
                //Generate random new client
                var client = ClientMock.GenerateRandomClient(0, generateClaims: true, generateProperties: true, generateSecrets: false);

                var clientRepository = GetClientRepository(context);

                //Add new client
                await clientRepository.AddClientAsync(client);

                var clientToClone = await context.Clients.Where(x => x.Id == client.Id).SingleOrDefaultAsync();

                //Try clone it
                var clonedClientId = await clientRepository.CloneClientAsync(clientToClone, cloneClientRedirectUris : false);

                var cloneClientEntity = await clientRepository.GetClientAsync(clonedClientId);

                var clientToCompare = await clientRepository.GetClientAsync(clientToClone.Id);

                ClientCloneCompare(cloneClientEntity, clientToCompare, cloneClientRedirectUris: false);
            }
        }