public JitAccessProvider(IDirectory directory, ILogger <JitAccessProvider> logger, IOptionsSnapshot <JitConfigurationOptions> options, IDiscoveryServices discoveryServices) { this.directory = directory; this.logger = logger; this.options = options.Value; this.discoveryServices = discoveryServices; }
public void TestInitialize() { directory = new ActiveDirectory(); options = new JitConfigurationOptions { DynamicGroupMappings = new List <JitDynamicGroupMapping>() }; logger = Global.LogFactory.CreateLogger <JitAccessProvider>(); }
public void TestInitialize() { this.discoveryServices = new DiscoveryServices(Global.LogFactory.CreateLogger <DiscoveryServices>()); directory = new ActiveDirectory(discoveryServices); options = new JitConfigurationOptions { DynamicGroupMappings = new List <JitDynamicGroupMapping>() }; logger = Global.LogFactory.CreateLogger <JitAccessProvider>(); }
public JitConfigurationViewModel(JitConfigurationOptions jitOptions, IDialogCoordinator dialogCoordinator, IDirectory directory, IJitGroupMappingViewModelFactory groupMappingFactory, INotifiableEventPublisher eventPublisher, IJitDomainStatusViewModelFactory jitDomainStatusFactory, IServiceSettingsProvider serviceSettings) { this.dialogCoordinator = dialogCoordinator; this.directory = directory; this.jitOptions = jitOptions; this.groupMappingFactory = groupMappingFactory; this.jitDomainStatusFactory = jitDomainStatusFactory; this.serviceSettings = serviceSettings; this.eventPublisher = eventPublisher; this.DisplayName = "Just-in-time access"; this.GroupMappings = new BindableCollection <JitGroupMappingViewModel>(); this.Domains = new BindableCollection <JitDomainStatusViewModel>(); }
public JitGroupWorker(ILogger <JitGroupWorker> logger, IOptions <JitConfigurationOptions> options, IJitAccessGroupResolver groupResolver, IDirectory directory) { this.logger = logger; this.options = options.Value; this.groupResolver = groupResolver; this.directory = directory; this.fullSyncInterval = Math.Max(1, this.options.FullSyncInterval ?? 60); this.deltaSyncInterval = Math.Max(0, this.options.DeltaSyncInterval ?? 1); if (this.deltaSyncInterval >= this.fullSyncInterval) { this.deltaSyncInterval = 0; } this.timerInterval = this.deltaSyncInterval <= 0 ? this.fullSyncInterval : this.deltaSyncInterval; }
public JitConfigurationViewModel(JitConfigurationOptions jitOptions, IDialogCoordinator dialogCoordinator, IJitGroupMappingViewModelFactory groupMappingFactory, INotifyModelChangedEventPublisher eventPublisher, IJitDomainStatusViewModelFactory jitDomainStatusFactory, IWindowsServiceProvider windowsServiceProvider, IShellExecuteProvider shellExecuteProvider, IDomainTrustProvider domainTrustProvider, IDiscoveryServices discoveryServices, IObjectSelectionProvider objectSelectionProvider, IScriptTemplateProvider scriptTemplateProvider) { this.shellExecuteProvider = shellExecuteProvider; this.dialogCoordinator = dialogCoordinator; this.jitOptions = jitOptions; this.groupMappingFactory = groupMappingFactory; this.jitDomainStatusFactory = jitDomainStatusFactory; this.windowsServiceProvider = windowsServiceProvider; this.eventPublisher = eventPublisher; this.domainTrustProvider = domainTrustProvider; this.discoveryServices = discoveryServices; this.objectSelectionProvider = objectSelectionProvider; this.scriptTemplateProvider = scriptTemplateProvider; this.DisplayName = "Just-in-time access"; this.GroupMappings = new BindableCollection <JitGroupMappingViewModel>(); this.Domains = new BindableCollection <JitDomainStatusViewModel>(); }
public void SerializeJitConfigurationOptions() { JitConfigurationOptions s = new JitConfigurationOptions(); s.EnableJitGroupCreation = true; s.DeltaSyncInterval = TestContext.CurrentContext.Random.Next(); s.FullSyncInterval = TestContext.CurrentContext.Random.Next(); s.JitGroupMappings = new List <JitGroupMapping> { new JitGroupMapping { ComputerOU = TestContext.CurrentContext.Random.GetString(), GroupOU = TestContext.CurrentContext.Random.GetString(), GroupNameTemplate = TestContext.CurrentContext.Random.GetString(), GroupType = GroupType.Universal, EnableJitGroupDeletion = false, GroupDescription = TestContext.CurrentContext.Random.GetString(), PreferredDC = TestContext.CurrentContext.Random.GetString(), Subtree = true } }; JitConfigurationOptions n = JsonConvert.DeserializeObject <JitConfigurationOptions>(JsonConvert.SerializeObject(s)); Assert.AreEqual(s.EnableJitGroupCreation, n.EnableJitGroupCreation); Assert.AreEqual(s.DeltaSyncInterval, n.DeltaSyncInterval); Assert.AreEqual(s.FullSyncInterval, n.FullSyncInterval); Assert.AreEqual(s.JitGroupMappings[0].ComputerOU, n.JitGroupMappings[0].ComputerOU); Assert.AreEqual(s.JitGroupMappings[0].GroupOU, n.JitGroupMappings[0].GroupOU); Assert.AreEqual(s.JitGroupMappings[0].GroupNameTemplate, n.JitGroupMappings[0].GroupNameTemplate); Assert.AreEqual(s.JitGroupMappings[0].GroupType, n.JitGroupMappings[0].GroupType); Assert.AreEqual(s.JitGroupMappings[0].EnableJitGroupDeletion, n.JitGroupMappings[0].EnableJitGroupDeletion); Assert.AreEqual(s.JitGroupMappings[0].GroupDescription, n.JitGroupMappings[0].GroupDescription); Assert.AreEqual(s.JitGroupMappings[0].PreferredDC, n.JitGroupMappings[0].PreferredDC); Assert.AreEqual(s.JitGroupMappings[0].Subtree, n.JitGroupMappings[0].Subtree); }