private Core.Entities.DeviceConnectionStatus GenerateSshConnectionDetails() { // Inserting device connection details Core.Entities.DeviceConnectionStatus deviceConnectionDetails = new Core.Entities.DeviceConnectionStatus(); deviceConnectionDetails.SshHost = settings.SshHost; deviceConnectionDetails.SshUser = settings.SshUser; deviceConnectionDetails.SshPort = settings.SshPort; deviceConnectionDetails.State = EnumClientConnectionState.Ready; using (sshondemandContext dbContext = new sshondemandContext()) { List <int> usedPorts = clientConnections.GetForwardingPorts(); for (int i = settings.SshFirstPort; i < settings.SshFirstPort + 1000; i++) { if (!usedPorts.Contains(i)) { deviceConnectionDetails.SshForwarding = i; break; } } return(deviceConnectionDetails); } }
public ManagementController( sshondemandContext dbContext, ClientRepository clientRepository, DeveloperAuthorizationsRepository developerAuthorizationsRepository) { this.dbContext = dbContext; this.clientRepository = clientRepository; this.developerAuthorizationsRepository = developerAuthorizationsRepository; }
private void UpdateSharedKeys() { using (sshondemandContext dbContext = new sshondemandContext()) { clientsSharedKeys.Clear(); foreach (var client in dbContext.Clients) { clientsSharedKeys.Add(client.ClientName, client.ClientKey); } } }
private void CheckActiveDeviceConnections() { List <string> deactivatedClients = new List <string>(); using (sshondemandContext dbContext = new sshondemandContext()) { ClientConnectionsRepository clientConnections = new ClientConnectionsRepository(dbContext); clientConnections.ResetOldConnections(15, out deactivatedClients); } Ssh ssh = new Ssh(settings); ssh.UnloadClientKeys(deactivatedClients); }
private void CheckActiveDeveloperRequests() { List <string> deactivatedClientNames = new List <string>(); using (sshondemandContext dbContext = new sshondemandContext()) { DeviceRequestsRepository deviceRequestsRepository = new DeviceRequestsRepository(dbContext); deviceRequestsRepository.DeactivateOldDeviceRequests(15, out deactivatedClientNames); } Ssh ssh = new Ssh(settings); ssh.UnloadClientKeys(deactivatedClientNames); }
public BaseRepository(sshondemandContext dbContext) { this.dbContext = dbContext; }
public ClientConnectionsRepository(sshondemandContext dbContext) : base(dbContext) { }
public DeviceRequestsRepository(sshondemandContext dbContext) : base(dbContext) { }
public ClientRepository(sshondemandContext dbContext) : base(dbContext) { }
public DeveloperAuthorizationsRepository(sshondemandContext dbContext) : base(dbContext) { }