Exemplo n.º 1
0
        public Resources(
            IIdentityService identityService,
            EventDispatcherMetaService eventDispatcher,
            ProviderManagerService providerManager,
            IDataStore <Resource> resourceStore,
            Func <Resource, ResourceViewModel> resourceViewModelDelegate)
        {
            _identityService = identityService;
            _eventDispatcher = eventDispatcher;
            _providerManager = providerManager;

            _resources         = resourceStore;
            _resourceViewModel = resourceViewModelDelegate;
        }
        public ScheduleRekeyingTasks(
            IOptions <AuthJanitorCoreConfiguration> configuration,
            EventDispatcherMetaService eventDispatcherMetaService,
            ProviderManagerService providerManager,
            IDataStore <ManagedSecret> managedSecretStore,
            IDataStore <Resource> resourceStore,
            IDataStore <RekeyingTask> rekeyingTaskStore)
        {
            _configuration = configuration.Value;
            _eventDispatcherMetaService = eventDispatcherMetaService;
            _providerManager            = providerManager;

            _managedSecrets = managedSecretStore;
            _resources      = resourceStore;
            _rekeyingTasks  = rekeyingTaskStore;
        }
Exemplo n.º 3
0
        public Dashboard(
            IIdentityService identityService,
            ProviderManagerService providerManager,
            IDataStore <ManagedSecret> managedSecretStore,
            IDataStore <Resource> resourceStore,
            IDataStore <RekeyingTask> rekeyingTaskStore,
            Func <ManagedSecret, ManagedSecretViewModel> managedSecretViewModelDelegate)
        {
            _identityService = identityService;
            _providerManager = providerManager;

            _managedSecrets = managedSecretStore;
            _resources      = resourceStore;
            _rekeyingTasks  = rekeyingTaskStore;

            _managedSecretViewModel = managedSecretViewModelDelegate;
        }
Exemplo n.º 4
0
 public AuthJanitorService(
     ILogger <AuthJanitorService> logger,
     ProviderManagerService providerManagerService,
     ICryptographicImplementation cryptographicImplementation,
     ISecureStorage secureStorage,
     IIdentityService identityService,
     EventDispatcherService eventDispatcherService,
     IAgentCommunicationProvider agentCommunicationProvider,
     IOptions <AuthJanitorServiceOptions> options)
 {
     _logger = logger;
     _providerManagerService      = providerManagerService;
     _cryptographicImplementation = cryptographicImplementation;
     _secureStorage              = secureStorage;
     _identityService            = identityService;
     _eventDispatcher            = eventDispatcherService;
     _agentCommunicationProvider = agentCommunicationProvider;
     _options = options;
 }
Exemplo n.º 5
0
        public ManagedSecrets(
            IOptions <AuthJanitorCoreConfiguration> configuration,
            IIdentityService identityService,
            ICryptographicImplementation cryptographicImplementation,
            EventDispatcherMetaService eventDispatcher,
            ProviderManagerService providerManager,
            IDataStore <ManagedSecret> managedSecretStore,
            IDataStore <Resource> resourceStore,
            Func <ManagedSecret, ManagedSecretViewModel> managedSecretViewModelDelegate)
        {
            _configuration               = configuration.Value;
            _identityService             = identityService;
            _cryptographicImplementation = cryptographicImplementation;
            _eventDispatcher             = eventDispatcher;
            _providerManager             = providerManager;

            _managedSecrets         = managedSecretStore;
            _resources              = resourceStore;
            _managedSecretViewModel = managedSecretViewModelDelegate;
        }
Exemplo n.º 6
0
        public RekeyingTasks(
            IOptions <AuthJanitorCoreConfiguration> configuration,
            IIdentityService identityService,
            TaskExecutionMetaService taskExecutionMetaService,
            EventDispatcherMetaService eventDispatcher,
            ProviderManagerService providerManager,
            IDataStore <ManagedSecret> managedSecretStore,
            IDataStore <RekeyingTask> rekeyingTaskStore,
            Func <RekeyingTask, RekeyingTaskViewModel> rekeyingTaskViewModelDelegate)
        {
            _configuration            = configuration.Value;
            _identityService          = identityService;
            _taskExecutionMetaService = taskExecutionMetaService;
            _eventDispatcher          = eventDispatcher;
            _providerManager          = providerManager;

            _managedSecrets        = managedSecretStore;
            _rekeyingTasks         = rekeyingTaskStore;
            _rekeyingTaskViewModel = rekeyingTaskViewModelDelegate;
        }
 public TaskExecutionMetaService(
     ILogger <TaskExecutionMetaService> logger,
     IServiceProvider serviceProvider,
     EventDispatcherService eventDispatcherService,
     IIdentityService identityService,
     ProviderManagerService providerManagerService,
     IDataStore <ManagedSecret> managedSecrets,
     IDataStore <RekeyingTask> rekeyingTasks,
     IDataStore <Resource> resources,
     ISecureStorage secureStorageProvider,
     AuthJanitorService authJanitorService)
 {
     _logger                 = logger;
     _serviceProvider        = serviceProvider;
     _eventDispatcherService = eventDispatcherService;
     _identityService        = identityService;
     _providerManagerService = providerManagerService;
     _managedSecrets         = managedSecrets;
     _rekeyingTasks          = rekeyingTasks;
     _resources              = resources;
     _secureStorageProvider  = secureStorageProvider;
     _authJanitorService     = authJanitorService;
 }
Exemplo n.º 8
0
        public override void Configure(IFunctionsHostBuilder builder)
        {
            var logger = LoggerFactory.Create(builder =>
            {
                builder.SetMinimumLevel(LogLevel.Debug)
                .AddConsole();
            }).CreateLogger <Startup>();

            builder.Services.AddOptions();

            logger.LogDebug("Registering Azure AD Identity Service");
            builder.Services.AddAJAzureActiveDirectory <AzureADIdentityServiceConfiguration>(o =>
            {
                o.ClientId     = "clientId";
                o.ClientSecret = "clientSecret";
                o.TenantId     = "tenantId";
            });

            logger.LogDebug("Registering Event Sinks");

            // TODO: Register IEventSinks here, before the EventDispatcherService
            //       This is where we offload to Azure Sentinel, send emails, etc.
            //       The *entire system* offloads to the EventDispatcherService to generalize events.

            logger.LogDebug("Registering Cryptographic Implementation");
            builder.Services.AddAJDefaultCryptographicImplementation <DefaultCryptographicImplementationConfiguration>(o =>
            {
                o.MasterEncryptionKey = "weakkey";
            });

            logger.LogDebug("Registering Secure Storage Provider");
            builder.Services.AddAJAzureKeyVault <KeyVaultSecureStorageProviderConfiguration>(o =>
            {
                o.VaultName = "vault";
            });

            logger.LogDebug("Registering AuthJanitor MetaServices");
            AuthJanitorServiceRegistration.RegisterServices(builder.Services);

            // -----

            logger.LogDebug("Registering DataStores");
            builder.Services.AddAJAzureBlobStorage <AzureBlobStorageDataStoreConfiguration>(o =>
            {
                o.ConnectionString = Environment.GetEnvironmentVariable("AzureWebJobsStorage", EnvironmentVariableTarget.Process);
                o.Container        = "authjanitor";
            });

            // -----

            logger.LogDebug("Registering ViewModel generators");
            ViewModelFactory.ConfigureServices(builder.Services);

            // -----

            logger.LogDebug("Scanning for Provider modules at {ProviderSearchPath}\\{ProviderSearchMask} recursively", PROVIDER_SEARCH_PATH, PROVIDER_SEARCH_MASK);

            var providerTypes = Directory.GetFiles(PROVIDER_SEARCH_PATH, PROVIDER_SEARCH_MASK, new EnumerationOptions()
            {
                RecurseSubdirectories = true
            })
                                .SelectMany(libraryFile => PluginLoader.CreateFromAssemblyFile(libraryFile, PROVIDER_SHARED_TYPES)
                                            .LoadDefaultAssembly()
                                            .GetTypes()
                                            .Where(type => !type.IsAbstract && typeof(IAuthJanitorProvider).IsAssignableFrom(type)))
                                .ToArray();

            logger.LogInformation("Found {ProviderCount} providers: {ProviderTypeNames}", providerTypes.Length, string.Join("  ", providerTypes.Select(t => t.Name)));
            logger.LogInformation("Registering Provider Manager Service");
            ProviderManagerService.ConfigureServices(builder.Services, providerTypes);
        }