Esempio n. 1
0
        static MainCollection()
        {
            _couchClient = new CouchClient(settings =>
            {
                settings.UseEndpoint("http://127.0.0.1:5984");
                settings.UseBasicAuthentication("admin", "admin");
            });

            IdentityBuilder builder = new(typeof(CouchDbUser), typeof(CouchDbRole), new ServiceCollection());

            builder.Services.AddIdentity <CouchDbUser, CouchDbRole>(config =>
            {
                config.Lockout = new LockoutOptions()
                {
                    MaxFailedAccessAttempts = 2
                };
                config.Password.RequireDigit           = false;
                config.Password.RequiredLength         = 3;
                config.Password.RequireLowercase       = false;
                config.Password.RequireNonAlphanumeric = false;
                config.Password.RequireUppercase       = false;
            });
            builder.AddCouchDbStores(config =>
            {
                config.SetDatabaseName("test_identity");
                config.UseClient(_couchClient);
            });

            builder.Services.AddLogging();

            _provider = builder.Services.BuildServiceProvider();
        }
Esempio n. 2
0
 public void WhenICallConnectToOnCouchClient()
 {
     try
     {
         couchClient = CouchClient.ConnectTo(address);
     }
     catch (CannotConnectToServerException e)
     {
         exception = e;
     }
 }
Esempio n. 3
0
 public async Task InitializeAsync()
 {
     _client = new CouchClient("http://localhost:5984", c =>
                               c.UseBasicAuthentication("admin", "admin"));
     _rebels = await _client.GetOrCreateDatabaseAsync <Rebel>();
 }
 public void GivenIHaveAnInstanceOfCouchClient()
 {
     couchClient = CouchClient.ConnectTo("http://127.0.0.1:5984");
 }
Esempio n. 5
0
 public Database_Tests()
 {
     _client = new CouchClient("http://localhost");
     _rebels = _client.GetDatabase <Rebel>();
 }
        /// <summary>
        /// Configures the CouchDB stores to use the specified client
        /// instead of retrieving it from the dependency injection container.
        /// </summary>
        /// <param name="client">The <see cref="ICouchClient"/>.</param>
        /// <returns>The <see cref="CouchDbIdentityBuilder"/>.</returns>
        public CouchDbIdentityBuilder UseClient(ICouchClient client)
        {
            Check.NotNull(client, nameof(client));

            return(Configure(options => options.CouchClient = client));
        }