예제 #1
0
        protected override void ModifyStore(FilesStore store)
        {
            FactIfWindowsAuthenticationIsAvailable.LoadCredentials();
            ConfigurationHelper.ApplySettingsToConventions(store.Conventions);

            base.ModifyStore(store);
        }
예제 #2
0
        public void CanUseWindowsAuthentication()
        {
            FactIfWindowsAuthenticationIsAvailable.LoadCredentials();
            Raven.Database.Server.Security.Authentication.EnableOnce();
            this.Server.Configuration.AnonymousUserAccessMode = AnonymousUserAccessMode.None;
            this.Server.SystemDatabase.Documents.Put(
                "Raven/Authorization/WindowsSettings",
                null,
                RavenJObject.FromObject(new WindowsAuthDocument
            {
                RequiredUsers = new List <WindowsAuthData>
                {
                    new WindowsAuthData
                    {
                        Name      = string.Format("{0}\\{1}", FactIfWindowsAuthenticationIsAvailable.Admin.Domain, FactIfWindowsAuthenticationIsAvailable.Admin.UserName),
                        Enabled   = true,
                        Databases = new List <ResourceAccess>
                        {
                            new ResourceAccess {
                                TenantId = "*"
                            },
                            new ResourceAccess {
                                TenantId = Constants.SystemDatabase
                            }
                        }
                    }
                }
            }), new RavenJObject(), null);

            using (var store = new DocumentStore
            {
                Credentials = new NetworkCredential(FactIfWindowsAuthenticationIsAvailable.User.UserName, FactIfWindowsAuthenticationIsAvailable.User.Password, FactIfWindowsAuthenticationIsAvailable.User.Domain),
                Url = this.Server.SystemDatabase.ServerUrl
            })
            {
                ConfigurationHelper.ApplySettingsToConventions(store.Conventions);

                store.Initialize();
                Assert.Throws <Raven.Abstractions.Connection.ErrorResponseException>(() => store.DatabaseCommands.Put("users/1", null, RavenJObject.FromObject(new User {
                }), new RavenJObject()));
            }

            using (var store = new DocumentStore
            {
                Credentials = new NetworkCredential(FactIfWindowsAuthenticationIsAvailable.Admin.UserName, FactIfWindowsAuthenticationIsAvailable.Admin.Password, FactIfWindowsAuthenticationIsAvailable.Admin.Domain),
                Url = this.Server.SystemDatabase.ServerUrl
            })
            {
                ConfigurationHelper.ApplySettingsToConventions(store.Conventions);

                store.Initialize();

                store.DatabaseCommands.Put("users/1", null, RavenJObject.FromObject(new User {
                }), new RavenJObject());
                var result = store.DatabaseCommands.Get("users/1");
                Assert.NotNull(result);
            }
        }
예제 #3
0
        protected override void ModifyStore(DocumentStore store)
        {
            FactIfWindowsAuthenticationIsAvailable.LoadCredentials();

            var isApiStore = _storeCounter % 2 == 0;

            store.Conventions.FailoverBehavior = FailoverBehavior.AllowReadsFromSecondaries;

            if (isApiStore)
            {
                store.Credentials = null;
                store.ApiKey      = apiKey;
            }
            else
            {
                store.Credentials = new NetworkCredential(FactIfWindowsAuthenticationIsAvailable.Admin.UserName, FactIfWindowsAuthenticationIsAvailable.Admin.Password, FactIfWindowsAuthenticationIsAvailable.Admin.Domain);
                store.ApiKey      = null;
            }

            ConfigurationHelper.ApplySettingsToConventions(store.Conventions);

            _storeCounter++;
        }
예제 #4
0
 public ReplicationWithMixedSecurity()
 {
     FactIfWindowsAuthenticationIsAvailable.LoadCredentials();
 }
예제 #5
0
 public WindowsAuthenticationUserInfo()
 {
     FactIfWindowsAuthenticationIsAvailable.LoadCredentials();
 }
예제 #6
0
 public ClientWindowsAuth()
 {
     FactIfWindowsAuthenticationIsAvailable.LoadCredentials();
 }
 public SynchronizationWithWindowsAuth()
 {
     FactIfWindowsAuthenticationIsAvailable.LoadCredentials();
 }