예제 #1
0
 /// <summary>
 /// Construct a <see cref="RepositoryController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="generalConfiguration"/></param>
 public RepositoryController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, IInstanceManager instanceManager, IGitHubClientFactory gitHubClientFactory, IJobManager jobManager, ILogger <RepositoryController> logger, IOptions <GeneralConfiguration> generalConfigurationOptions) : base(databaseContext, authenticationContextFactory, logger, true, true)
 {
     this.instanceManager     = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
     this.gitHubClientFactory = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.jobManager          = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     generalConfiguration     = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
예제 #2
0
 /// <summary>
 /// Construct a <see cref="InstanceController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="portAllocator">The value of <see cref="IPortAllocator"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="swarmConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="swarmConfiguration"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 public InstanceController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IJobManager jobManager,
     IInstanceManager instanceManager,
     IIOManager ioManager,
     IPortAllocator portAllocator,
     IPlatformIdentifier platformIdentifier,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     IOptions <SwarmConfiguration> swarmConfigurationOptions,
     ILogger <InstanceController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     this.jobManager         = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.instanceManager    = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
     this.ioManager          = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.platformIdentifier = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.portAllocator      = portAllocator ?? throw new ArgumentNullException(nameof(portAllocator));
     generalConfiguration    = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
     swarmConfiguration      = swarmConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(swarmConfigurationOptions));
 }
 /// <summary>
 /// Construct an <see cref="AdministrationController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/></param>
 /// <param name="serverUpdater">The value of <see cref="serverUpdater"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 /// <param name="updatesConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="updatesConfiguration"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="generalConfiguration"/></param>
 public AdministrationController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IGitHubClientFactory gitHubClientFactory,
     IServerControl serverUpdater,
     IApplication application,
     IIOManager ioManager,
     IPlatformIdentifier platformIdentifier,
     ILogger <AdministrationController> logger,
     IOptions <UpdatesConfiguration> updatesConfigurationOptions,
     IOptions <GeneralConfiguration> generalConfigurationOptions)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         false,
         true)
 {
     this.gitHubClientFactory = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.serverUpdater       = serverUpdater ?? throw new ArgumentNullException(nameof(serverUpdater));
     this.application         = application ?? throw new ArgumentNullException(nameof(application));
     this.ioManager           = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     updatesConfiguration     = updatesConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(updatesConfigurationOptions));
     generalConfiguration     = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdministrationController"/> class.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/>.</param>
 /// <param name="serverControl">The value of <see cref="serverControl"/>.</param>
 /// <param name="serverUpdater">The value of <see cref="serverUpdater"/>.</param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/>.</param>
 /// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 /// <param name="updatesConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="updatesConfiguration"/>.</param>
 /// <param name="fileLoggingConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="fileLoggingConfiguration"/>.</param>
 public AdministrationController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IGitHubClientFactory gitHubClientFactory,
     IServerControl serverControl,
     IServerUpdateInitiator serverUpdater,
     IAssemblyInformationProvider assemblyInformationProvider,
     IIOManager ioManager,
     IPlatformIdentifier platformIdentifier,
     IFileTransferTicketProvider fileTransferService,
     ILogger <AdministrationController> logger,
     IOptions <UpdatesConfiguration> updatesConfigurationOptions,
     IOptions <FileLoggingConfiguration> fileLoggingConfigurationOptions)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     this.gitHubClientFactory         = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.serverControl               = serverControl ?? throw new ArgumentNullException(nameof(serverControl));
     this.serverUpdater               = serverUpdater ?? throw new ArgumentNullException(nameof(serverUpdater));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.ioManager           = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.platformIdentifier  = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.fileTransferService = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
     updatesConfiguration     = updatesConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(updatesConfigurationOptions));
     fileLoggingConfiguration = fileLoggingConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(fileLoggingConfigurationOptions));
 }
예제 #5
0
 /// <summary>
 /// Construct a <see cref="InstanceController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public InstanceController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, IJobManager jobManager, IInstanceManager instanceManager, IIOManager ioManager, IApplication application, ILogger <InstanceController> logger) : base(databaseContext, authenticationContextFactory, logger, false)
 {
     this.jobManager      = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.instanceManager = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
     this.ioManager       = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.application     = application ?? throw new ArgumentNullException(nameof(application));
 }
예제 #6
0
 /// <summary>
 /// Construct a <see cref="HomeController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="tokenFactory">The value of <see cref="tokenFactory"/></param>
 /// <param name="systemIdentityFactory">The value of <see cref="systemIdentityFactory"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/></param>
 /// <param name="identityCache">The value of <see cref="identityCache"/></param>
 /// <param name="oAuthProviders">The value of <see cref="oAuthProviders"/>.</param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/>.</param>
 /// <param name="browserResolver">The value of <see cref="browserResolver"/></param>
 /// <param name="swarmService">The value of <see cref="swarmService"/>.</param>
 /// <param name="serverControl">The value of <see cref="serverControl"/>.</param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="controlPanelConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="controlPanelConfiguration"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public HomeController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     ITokenFactory tokenFactory,
     ISystemIdentityFactory systemIdentityFactory,
     ICryptographySuite cryptographySuite,
     IAssemblyInformationProvider assemblyInformationProvider,
     IIdentityCache identityCache,
     IOAuthProviders oAuthProviders,
     IPlatformIdentifier platformIdentifier,
     IBrowserResolver browserResolver,
     ISwarmService swarmService,
     IServerControl serverControl,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     IOptions <ControlPanelConfiguration> controlPanelConfigurationOptions,
     ILogger <HomeController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         false)
 {
     this.tokenFactory                = tokenFactory ?? throw new ArgumentNullException(nameof(tokenFactory));
     this.systemIdentityFactory       = systemIdentityFactory ?? throw new ArgumentNullException(nameof(systemIdentityFactory));
     this.cryptographySuite           = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.identityCache               = identityCache ?? throw new ArgumentNullException(nameof(identityCache));
     this.platformIdentifier          = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     this.oAuthProviders              = oAuthProviders ?? throw new ArgumentNullException(nameof(oAuthProviders));
     this.browserResolver             = browserResolver ?? throw new ArgumentNullException(nameof(browserResolver));
     this.swarmService                = swarmService ?? throw new ArgumentNullException(nameof(swarmService));
     this.serverControl               = serverControl ?? throw new ArgumentNullException(nameof(serverControl));
     generalConfiguration             = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
     controlPanelConfiguration        = controlPanelConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(controlPanelConfigurationOptions));
 }
 /// <summary>
 /// Construct a <see cref="UserController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="systemIdentityFactory">The value of <see cref="systemIdentityFactory"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="logger">The value of <see cref="logger"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/></param>
 public UserController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ISystemIdentityFactory systemIdentityFactory, ICryptographySuite cryptographySuite, ILogger <UserController> logger, IOptions <GeneralConfiguration> generalConfigurationOptions) : base(databaseContext, authenticationContextFactory, logger, false, true)
 {
     this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
     this.systemIdentityFactory = systemIdentityFactory ?? throw new ArgumentNullException(nameof(systemIdentityFactory));
     this.cryptographySuite     = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     generalConfiguration       = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
 /// <summary>
 /// Construct a <see cref="HomeController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="tokenFactory">The value of <see cref="tokenFactory"/></param>
 /// <param name="systemIdentityFactory">The value of <see cref="systemIdentityFactory"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="identityCache">The value of <see cref="identityCache"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public HomeController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ITokenFactory tokenFactory, ISystemIdentityFactory systemIdentityFactory, ICryptographySuite cryptographySuite, IApplication application, IIdentityCache identityCache, ILogger <HomeController> logger) : base(databaseContext, authenticationContextFactory, logger, false)
 {
     this.tokenFactory          = tokenFactory ?? throw new ArgumentNullException(nameof(tokenFactory));
     this.systemIdentityFactory = systemIdentityFactory ?? throw new ArgumentNullException(nameof(systemIdentityFactory));
     this.cryptographySuite     = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.application           = application ?? throw new ArgumentNullException(nameof(application));
     this.identityCache         = identityCache ?? throw new ArgumentNullException(nameof(identityCache));
 }
 /// <summary>
 /// Construct an <see cref="AdministrationController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="gitHubClient">The value of <see cref="gitHubClient"/></param>
 /// <param name="serverUpdater">The value of <see cref="serverUpdater"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 /// <param name="updatesConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing value of <see cref="updatesConfiguration"/></param>
 public AdministrationController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, IGitHubClient gitHubClient, IServerControl serverUpdater, IApplication application, IIOManager ioManager, ILogger <AdministrationController> logger, IOptions <UpdatesConfiguration> updatesConfigurationOptions) : base(databaseContext, authenticationContextFactory, logger, false)
 {
     this.gitHubClient    = gitHubClient ?? throw new ArgumentNullException(nameof(gitHubClient));
     this.serverUpdater   = serverUpdater ?? throw new ArgumentNullException(nameof(serverUpdater));
     this.application     = application ?? throw new ArgumentNullException(nameof(application));
     this.ioManager       = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     updatesConfiguration = updatesConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(updatesConfigurationOptions));
 }
예제 #10
0
 /// <summary>
 /// Construct a <see cref="HomeController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="tokenFactory">The value of <see cref="tokenFactory"/></param>
 /// <param name="systemIdentityFactory">The value of <see cref="systemIdentityFactory"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="application">The value of <see cref="application"/></param>
 /// <param name="identityCache">The value of <see cref="identityCache"/></param>
 /// <param name="browserResolver">The value of <see cref="browserResolver"/></param>
 /// <param name="controlPanelConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="controlPanelConfiguration"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public HomeController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ITokenFactory tokenFactory, ISystemIdentityFactory systemIdentityFactory, ICryptographySuite cryptographySuite, IApplication application, IIdentityCache identityCache, IBrowserResolver browserResolver, IOptions <ControlPanelConfiguration> controlPanelConfigurationOptions, ILogger <HomeController> logger) : base(databaseContext, authenticationContextFactory, logger, false, false)
 {
     this.tokenFactory          = tokenFactory ?? throw new ArgumentNullException(nameof(tokenFactory));
     this.systemIdentityFactory = systemIdentityFactory ?? throw new ArgumentNullException(nameof(systemIdentityFactory));
     this.cryptographySuite     = cryptographySuite ?? throw new ArgumentNullException(nameof(cryptographySuite));
     this.application           = application ?? throw new ArgumentNullException(nameof(application));
     this.identityCache         = identityCache ?? throw new ArgumentNullException(nameof(identityCache));
     this.browserResolver       = browserResolver ?? throw new ArgumentNullException(nameof(browserResolver));
     controlPanelConfiguration  = controlPanelConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(controlPanelConfigurationOptions));
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstancePermissionSetController"/> class.
 /// </summary>
 /// <param name="instanceManager">The <see cref="IInstanceManager"/> for the <see cref="InstanceRequiredController"/>.</param>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 public InstancePermissionSetController(
     IInstanceManager instanceManager,
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     ILogger <InstancePermissionSetController> logger)
     : base(
         instanceManager,
         databaseContext,
         authenticationContextFactory,
         logger)
 {
 }
예제 #12
0
 /// <summary>
 /// Construct a <see cref="ChatController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="instanceManager">The <see cref="IInstanceManager"/> for the <see cref="InstanceRequiredController"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public ChatController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IInstanceManager instanceManager,
     ILogger <ChatController> logger)
     : base(
         instanceManager,
         databaseContext,
         authenticationContextFactory,
         logger)
 {
 }
예제 #13
0
 /// <summary>
 /// Construct an <see cref="ApiController"/>
 /// </summary>
 /// <param name="databaseContext">The value of <see cref="DatabaseContext"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="logger">The value of <see cref="Logger"/></param>
 /// <param name="requireInstance">The value of <see cref="requireInstance"/></param>
 public ApiController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ILogger logger, bool requireInstance)
 {
     DatabaseContext = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext));
     if (authenticationContextFactory == null)
     {
         throw new ArgumentNullException(nameof(authenticationContextFactory));
     }
     Logger = logger ?? throw new ArgumentNullException(nameof(logger));
     AuthenticationContext = authenticationContextFactory.CurrentAuthenticationContext;
     Instance             = AuthenticationContext?.InstanceUser?.Instance;
     this.requireInstance = requireInstance;
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstanceRequiredController"/> <see langword="class"/>.
 /// </summary>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/>.</param>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 protected InstanceRequiredController(
     IInstanceManager instanceManager,
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     ILogger <InstanceRequiredController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     this.instanceManager = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserGroupController"/> <see langword="clas"/>.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 public UserGroupController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     ILogger <UserGroupController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     generalConfiguration = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransferController"/> <see langword="class"/>.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public TransferController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IFileTransferStreamHandler fileTransferService,
     ILogger <ApiController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         true)
 {
     this.fileTransferService = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
 }
예제 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigurationController"/> class.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="instanceManager">The <see cref="IInstanceManager"/> for the <see cref="InstanceRequiredController"/>.</param>
 /// <param name="ioManager">The value of <see cref="ioManager"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 public ConfigurationController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IInstanceManager instanceManager,
     IIOManager ioManager,
     ILogger <ConfigurationController> logger)
     : base(
         instanceManager,
         databaseContext,
         authenticationContextFactory,
         logger)
 {
     this.ioManager = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
 }
예제 #18
0
 /// <summary>
 /// Construct a <see cref="DreamMakerController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="instanceManager">The <see cref="IInstanceManager"/> for the <see cref="InstanceRequiredController"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public DreamMakerController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IJobManager jobManager,
     IInstanceManager instanceManager,
     ILogger <DreamMakerController> logger)
     : base(
         instanceManager,
         databaseContext,
         authenticationContextFactory,
         logger)
 {
     this.jobManager = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
 }
예제 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ByondController"/> class.
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/>.</param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/>.</param>
 /// <param name="instanceManager">The <see cref="IInstanceManager"/> for the <see cref="InstanceRequiredController"/>.</param>
 /// <param name="jobManager">The value of <see cref="jobManager"/>.</param>
 /// <param name="fileTransferService">The value of <see cref="fileTransferService"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/>.</param>
 public ByondController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IInstanceManager instanceManager,
     IJobManager jobManager,
     IFileTransferTicketProvider fileTransferService,
     ILogger <ByondController> logger)
     : base(
         instanceManager,
         databaseContext,
         authenticationContextFactory,
         logger)
 {
     this.jobManager          = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.fileTransferService = fileTransferService ?? throw new ArgumentNullException(nameof(fileTransferService));
 }
예제 #20
0
 /// <summary>
 /// Construct an <see cref="ApiController"/>
 /// </summary>
 /// <param name="databaseContext">The value of <see cref="DatabaseContext"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="logger">The value of <see cref="Logger"/></param>
 /// <param name="requireHeaders">The value of <see cref="requireHeaders"/></param>
 protected ApiController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     ILogger <ApiController> logger,
     bool requireHeaders)
 {
     DatabaseContext = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext));
     if (authenticationContextFactory == null)
     {
         throw new ArgumentNullException(nameof(authenticationContextFactory));
     }
     Logger = logger ?? throw new ArgumentNullException(nameof(logger));
     AuthenticationContext = authenticationContextFactory.CurrentAuthenticationContext;
     Instance            = AuthenticationContext?.InstancePermissionSet?.Instance;
     this.requireHeaders = requireHeaders;
 }
예제 #21
0
 /// <summary>
 /// Construct a <see cref="RepositoryController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="instanceManager">The <see cref="IInstanceManager"/> for the <see cref="InstanceRequiredController"/>.</param>
 /// <param name="gitHubClientFactory">The value of <see cref="gitHubClientFactory"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public RepositoryController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IInstanceManager instanceManager,
     IGitHubClientFactory gitHubClientFactory,
     IJobManager jobManager,
     ILogger <RepositoryController> logger)
     : base(
         instanceManager,
         databaseContext,
         authenticationContextFactory,
         logger)
 {
     this.gitHubClientFactory = gitHubClientFactory ?? throw new ArgumentNullException(nameof(gitHubClientFactory));
     this.jobManager          = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
 }
예제 #22
0
 /// <summary>
 /// Construct a <see cref="HomeController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="tokenFactory">The value of <see cref="tokenFactory"/></param>
 /// <param name="systemIdentityFactory">The value of <see cref="systemIdentityFactory"/></param>
 /// <param name="cryptographySuite">The value of <see cref="cryptographySuite"/></param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/></param>
 /// <param name="identityCache">The value of <see cref="identityCache"/></param>
 /// <param name="browserResolver">The value of <see cref="browserResolver"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="controlPanelConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="controlPanelConfiguration"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public HomeController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     ITokenFactory tokenFactory,
     ISystemIdentityFactory systemIdentityFactory,
     ICryptographySuite cryptographySuite,
     IAssemblyInformationProvider assemblyInformationProvider,
     IIdentityCache identityCache,
     IBrowserResolver browserResolver,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     IOptions <ControlPanelConfiguration> controlPanelConfigurationOptions,
     ILogger <HomeController> logger)
     : base(
         databaseContext,
         authenticationContextFactory,
         logger,
         (browserResolver ?? throw new ArgumentNullException(nameof(browserResolver))).Browser.Type != BrowserType.Generic &&
예제 #23
0
 /// <summary>
 /// Construct a <see cref="InstanceController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="jobManager">The value of <see cref="jobManager"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="ioManager">The value of <see cref="ioManager"/></param>
 /// <param name="assemblyInformationProvider">The value of <see cref="assemblyInformationProvider"/></param>
 /// <param name="platformIdentifier">The value of <see cref="platformIdentifier"/></param>
 /// <param name="generalConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="generalConfiguration"/>.</param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public InstanceController(
     IDatabaseContext databaseContext,
     IAuthenticationContextFactory authenticationContextFactory,
     IJobManager jobManager,
     IInstanceManager instanceManager,
     IIOManager ioManager,
     IAssemblyInformationProvider assemblyInformationProvider,
     IPlatformIdentifier platformIdentifier,
     IOptions <GeneralConfiguration> generalConfigurationOptions,
     ILogger <InstanceController> logger)
     : base(databaseContext, authenticationContextFactory, logger, false, true)
 {
     this.jobManager                  = jobManager ?? throw new ArgumentNullException(nameof(jobManager));
     this.instanceManager             = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
     this.ioManager                   = ioManager ?? throw new ArgumentNullException(nameof(ioManager));
     this.assemblyInformationProvider = assemblyInformationProvider ?? throw new ArgumentNullException(nameof(assemblyInformationProvider));
     this.platformIdentifier          = platformIdentifier ?? throw new ArgumentNullException(nameof(platformIdentifier));
     generalConfiguration             = generalConfigurationOptions?.Value ?? throw new ArgumentNullException(nameof(generalConfigurationOptions));
 }
예제 #24
0
        internal AuthenticationService(
            ClientList clientList,
            IAuthenticationContextFactory contextFactory,
            IPasswordService passwordService,
            IMainThreadDispatcher dispatcher,
            ILoggerFactory loggerFactory,
            ServerOptionsProvider optionsProvider,
            IPacketWriterPool packetWriterPool,
            ComponentSelector <Account> componentSelector)
        {
            if (clientList == null)
            {
                throw new ArgumentNullException(nameof(clientList));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            if (optionsProvider == null)
            {
                throw new ArgumentNullException(nameof(optionsProvider));
            }

            _ContextFactory    = contextFactory ?? throw new ArgumentNullException(nameof(contextFactory));
            _PasswordService   = passwordService ?? throw new ArgumentNullException(nameof(passwordService));
            _Dispatcher        = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher));
            _PacketWriterPool  = packetWriterPool ?? throw new ArgumentNullException(nameof(packetWriterPool));
            _ComponentSelector = componentSelector ?? throw new ArgumentNullException(nameof(componentSelector));
            _Log = loggerFactory.GetLogger(GetType());

            _ClientIdLoggedIn = new bool[optionsProvider.Slot];


            clientList.ClientDisconnected += (sender, args) => LogoutClient(args.Client);
            ClientLoggedOut += (sender, args) => _Log.Info($"User '{args.Account.UserName}' has logged out");
            ClientLoggedIn  += (sender, args) => _Log.Info($"User '{args.Session.Account.UserName}' logged has logged in");
            AccountCreated  += (sender, args) => _Log.Info($"Account with username '{args.NewAccount.UserName}' has been created");
        }
 /// <summary>
 /// Construct a <see cref="ChatController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="instanceManager">The value of <see cref="instanceManager"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public ChatController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, IInstanceManager instanceManager, ILogger <ChatController> logger) : base(databaseContext, authenticationContextFactory, logger, true, true)
 {
     this.instanceManager = instanceManager ?? throw new ArgumentNullException(nameof(instanceManager));
 }
예제 #26
0
 /// <summary>
 /// Construct a <see cref="UserController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public InstanceUserController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ILogger <InstanceUserController> logger) : base(databaseContext, authenticationContextFactory, logger, true)           //false instance requirement, we handle this ourself
 {
 }
예제 #27
0
 /// <summary>
 /// Construct a <see cref="ModelController{TModel}"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 /// <param name="requireInstance">If the <see cref="ModelController{TModel}"/> requires an <see cref="IAuthenticationContext.InstanceUser"/></param>
 public ModelController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ILogger logger, bool requireInstance) : base(databaseContext, authenticationContextFactory, logger, requireInstance, true)
 {
 }
예제 #28
0
 /// <summary>
 /// Construct a <see cref="ClaimsInjector"/>
 /// </summary>
 /// <param name="authenticationContextFactory">The value of <see cref="authenticationContextFactory"/></param>
 public ClaimsInjector(IAuthenticationContextFactory authenticationContextFactory)
 {
     this.authenticationContextFactory = authenticationContextFactory ?? throw new ArgumentNullException(nameof(authenticationContextFactory));
 }
 /// <summary>
 /// Construct a <see cref="ClaimsInjector"/>
 /// </summary>
 /// <param name="databaseContext">The value of <see cref="databaseContext"/></param>
 /// <param name="authenticationContextFactory">The value of <see cref="authenticationContextFactory"/></param>
 public ClaimsInjector(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory)
 {
     this.databaseContext = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext));
     this.authenticationContextFactory = authenticationContextFactory ?? throw new ArgumentNullException(nameof(authenticationContextFactory));
 }
예제 #30
0
 /// <summary>
 /// Construct a <see cref="UserController"/>
 /// </summary>
 /// <param name="databaseContext">The <see cref="IDatabaseContext"/> for the <see cref="ApiController"/></param>
 /// <param name="authenticationContextFactory">The <see cref="IAuthenticationContextFactory"/> for the <see cref="ApiController"/></param>
 /// <param name="logger">The <see cref="ILogger"/> for the <see cref="ApiController"/></param>
 public InstanceUserController(IDatabaseContext databaseContext, IAuthenticationContextFactory authenticationContextFactory, ILogger <InstanceUserController> logger) : base(databaseContext, authenticationContextFactory, logger, true, true)
 {
 }