public UserSynchronizationService(ILog logger, int currentUserId, int languageId) { _logger = logger; _languageId = languageId; _activeDirectory = new ActiveDirectoryRepository(); QPContext.CurrentUserId = currentUserId; }
protected override void BeginProcessing() { base.BeginProcessing(); var commitCommandFactory = new CommitApiCommandFactory( new ApiUriFactory(Connection.Host), new CommitApiPostKeyValuePairFactory(this.Connection.AccessToken)); commitCommand = commitCommandFactory.CreateCommit(true); activeDirectoryRepository = new ActiveDirectoryRepository(ForestName, Credential); addressGroupSearchableRepository = new SearchableRepository <AddressGroupObject>( new ConfigCommandFactory( new ApiUriFactory(Connection.Host), new ConfigPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys)), Schema.AddressGroupSchemaName); addressSearchableRepository = new SearchableRepository <AddressObject>( new ConfigCommandFactory( new ApiUriFactory(Connection.Host), new ConfigPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys)), Schema.AddressSchemaName); addableRepository = new AddableRepository( new ConfigCommandFactory( new ApiUriFactory(Connection.Host), new ConfigPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys))); membershipRepository = new MembershipRepository( new ConfigMembershipCommandFactory( new ApiUriFactory(Connection.Host), new ConfigMembershipPostKeyValuePairFactory(Connection.AccessToken, Connection.Vsys))); }
private void Window_Loaded(object sender, RoutedEventArgs e) { Config = new Config(); activeDirectoryRepository = new ActiveDirectoryRepository(Config); txtUsername.Text = Config.ActiveDirectoryUsername; chkImpersonate.IsChecked = Config.UseImpersonation; chkUseLDAPS.IsChecked = Config.UseLDAPS; // Get the root directoryentry for the domain that this program is running on, so we can show the entire OU tree DirectoryEntry rootDSE = new DirectoryEntry("LDAP://RootDSE"); string rootOU_DN = rootDSE.Properties["defaultNamingContext"].Value.ToString(); txtOUDN.Text = Config.ActiveDirectoryRootOUs.ToSemicolenSeparatedString(); try { ADOrganizationalUnit allOUTree = activeDirectoryRepository.GetOUTree(rootOU_DN); TreeViewItem tree = convertToTreeViewItem(allOUTree); treeOUList.Items.Add(tree); } catch (Exception ex) { MessageBox.Show("Error loading from AD: " + ex.Message, "Error loading from AD", MessageBoxButton.OK, MessageBoxImage.Error); } }
public void ActiveDirectoryAuthenticator_Authenticate_ProvideValidCredentials_ReturnsTrue() { ActiveDirectoryRepository activeDirectoryAuthenticator = new ActiveDirectoryRepository(); bool isAuthenticated = activeDirectoryAuthenticator.Authenticate(username, password, domain); Assert.IsTrue(isAuthenticated); }
/// <summary> /// Gets the name identifier based in the identity claim. /// </summary> /// <param name="identityClaim">The identity claim.</param> /// <returns>A name identifier.</returns> private static string GetNameId(Claim identityClaim) { var repository = new ActiveDirectoryRepository(); var nameid = $"urn:collab:person:{Settings.Default.schacHomeOrganization}:{repository.GetUserIdForIdentity(identityClaim)}"; nameid = nameid.Replace('@', '_'); return(nameid); }
public void ActiveDirectoryAuthenticator_Authenticate_ProvideInvalidCredentials_ReturnsFalse() { ActiveDirectoryRepository activeDirectoryAuthenticator = new ActiveDirectoryRepository(); bool isAuthenticated = activeDirectoryAuthenticator.Authenticate(username, invalidPassword, domain); //Authenticate with validate credentials just to reset the bad password count activeDirectoryAuthenticator.Authenticate(username, password, domain); Assert.IsFalse(isAuthenticated); }
public void AddressGroupFromDomainControllersInRootDomainTest() { var activeDirectoryRepository = new ActiveDirectoryRepository("NTDEV.CORP.MICROSOFT.COM", null); var group = activeDirectoryRepository.AddressGroupFromDomainControllersInRootDomain("NTDEVDCs"); Assert.IsNotNull(group); Assert.AreEqual(group.Members.Count, group.MemberObjects.Count); foreach (var memberObject in group.MemberObjects) { Assert.IsTrue(group.Members.Contains(memberObject.Name)); Assert.That(memberObject, Is.TypeOf <AddressObject>()); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { Config = new Config(); if (Config.ActiveDirectoryRootOUs.Count <= 0) { MessageBox.Show("ERROR: No OUs are configured, so no users can be loaded. Please have your IT department create a configuration file.", "Error loading config file", MessageBoxButton.OK, MessageBoxImage.Error); Close(); } adRepo = new ActiveDirectoryRepository(Config); lblBlankPassword.Content = "If left blank, password will be: " + Config.DefaultNewPassword; // Load AD users RefreshADUserListFromAD(); }
private void InitializeApp(IServiceCollection services, AppSettings appSettings) { //singleton pattern here was a huge mistake, i'm going to fix this. LiteDbConfigurationRepository configurationRepository = new LiteDbConfigurationRepository(databaseLocator.GetConfigurationRepositoryConnectionString()); appConfig = configurationRepository.GetAppConfig(); ActiveDirectoryRepository activeDirectory = new ActiveDirectoryRepository(); EncryptionProvider cipher = new EncryptionProvider(appConfig.EncryptionKey); services.AddSingleton <EncryptionProvider>(cipher); services.AddSingleton <IActiveDirectoryAuthenticator>(activeDirectory); services.AddSingleton <IActiveDirectoryRepository>(activeDirectory); IdentityAuthenticationLogic identityAuthenticationLogic = new IdentityAuthenticationLogic(configurationRepository, activeDirectory); services.AddSingleton <IdentityAuthenticationLogic>(); ICertificateRepository certificateRepository = new LiteDbCertificateRepository(databaseLocator.GetCertificateRepositoryConnectionString()); RuntimeCacheRepository runtimeCacheRepository = null; LiteDbAuditRepository auditRepository = new LiteDbAuditRepository(databaseLocator.GetAuditRepositoryConnectionString()); IAuditLogic auditLogic = new AuditLogic(auditRepository, configurationRepository); services.AddSingleton <IAuditLogic>(auditLogic); IAuthorizationLogic authorizationLogic = new AuthorizationLogic(configurationRepository, auditLogic); IScriptManagementLogic scriptManagement = new ScriptManagementLogic(configurationRepository, authorizationLogic); services.AddSingleton <IScriptManagementLogic>(scriptManagement); IPowershellEngine powershellEngine = new PowershellEngine(auditLogic, scriptManagement); services.AddSingleton <IPowershellEngine>(powershellEngine); RoleManagementLogic roleManagementLogic = new RoleManagementLogic(configurationRepository, authorizationLogic); services.AddSingleton <RoleManagementLogic>(roleManagementLogic); UserManagementLogic userManagementLogic = new UserManagementLogic(configurationRepository, authorizationLogic); services.AddSingleton <UserManagementLogic>(userManagementLogic); SecurityPrincipalLogic securityPrincipalLogic = new SecurityPrincipalLogic(roleManagementLogic, userManagementLogic); services.AddSingleton <SecurityPrincipalLogic>(); AdcsTemplateLogic adcsTemplateLogic = new AdcsTemplateLogic(configurationRepository, activeDirectory); services.AddSingleton <AdcsTemplateLogic>(adcsTemplateLogic); services.AddSingleton <IAuthorizationLogic>(authorizationLogic); services.AddSingleton <IConfigurationRepository>(configurationRepository); ICertificateProvider certificateProvider = new Win32CertificateProvider(); services.AddSingleton <ICertificateProvider>(certificateProvider); services.AddSingleton <ICertificateRepository>(certificateRepository); ActiveDirectoryIdentityProviderLogic activeDirectoryIdentityProviderLogic = new ActiveDirectoryIdentityProviderLogic(configurationRepository); services.AddSingleton <ActiveDirectoryIdentityProviderLogic>(activeDirectoryIdentityProviderLogic); certificateManagementLogic = new CertificateManagementLogic( configurationRepository, certificateRepository, authorizationLogic, auditLogic, securityPrincipalLogic, cipher); services.AddSingleton <CertificateManagementLogic>(certificateManagementLogic); PrivateCertificateProcessing privateCertificateProcessing = new PrivateCertificateProcessing(certificateRepository, configurationRepository, certificateProvider, authorizationLogic, adcsTemplateLogic, auditLogic); services.AddSingleton <IPrivateCertificateProcessing>(privateCertificateProcessing); services.AddSingleton <NodeLogic>(new NodeLogic(configurationRepository, authorizationLogic, activeDirectoryIdentityProviderLogic, powershellEngine, auditLogic, certificateManagementLogic, privateCertificateProcessing)); services.AddSingleton <IRuntimeConfigurationState>( new RuntimeConfigurationState(configurationRepository, runtimeCacheRepository) { InitialSetupComplete = initialSetupComplete }); services.AddSingleton <IClientsideConfigurationProvider>(new ClientsideConfigurationProvider(configurationRepository)); services.AddSingleton <AnalyticsLogic>(new AnalyticsLogic(configurationRepository, certificateRepository, auditRepository)); services.AddSingleton <DataRenderingProvider>(new DataRenderingProvider()); oidcLogic = new OpenIdConnectIdentityProviderLogic(configurationRepository, authorizationLogic); services.AddSingleton <IOpenIdConnectIdentityProviderLogic>(oidcLogic); }
public ActiveDirectoryService(string activeDirectlryUrl, string username, string password) { Repository = new ActiveDirectoryRepository(activeDirectlryUrl, username, password); }
protected override void BeginProcessing() { activeDirectoryRepository = new ActiveDirectoryRepository(ForestName, Credential); }
public void InitializeTest() { activeDirectory = new ActiveDirectoryRepository(); metadata = new ActiveDirectoryMetadata(domain, username, password); }
public UserSynchronizationService(IOptions <CommonSchedulerProperties> options) { _languageId = options.Value.DefaultLanguageId; _activeDirectory = new ActiveDirectoryRepository(); settings = options.Value; }