/// <summary>
        /// Default constuctor
        /// </summary>
        /// <param name="configuration">DeviceHiveConfiguration object</param>
        public PasswordPolicyValidator(DeviceHiveConfiguration configuration)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            _configuration = configuration;
        }
 public ClientController(ActionInvoker actionInvoker, DataContext dataContext,
     JsonMapperManager jsonMapperManager, DeviceHiveConfiguration deviceHiveConfiguration,
     MessageBus messageBus, IMessageManager messageManager) :
     base(actionInvoker, dataContext, jsonMapperManager, deviceHiveConfiguration)
 {
     _messageBus = messageBus;
     _messageManager = messageManager;
 }
 public DeviceController(ActionInvoker actionInvoker, DataContext dataContext,
     JsonMapperManager jsonMapperManager, DeviceHiveConfiguration deviceHiveConfiguration,
     IMessageManager messageManager, DeviceService deviceService) :
     base(actionInvoker, dataContext, jsonMapperManager, deviceHiveConfiguration)
 {
     _messageManager = messageManager;
     _deviceService = deviceService;
 }
Esempio n. 4
0
        /// <summary>
        /// Default constuctor
        /// </summary>
        /// <param name="configuration">DeviceHiveConfiguration object</param>
        public PasswordPolicyValidator(DeviceHiveConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            _configuration = configuration;
        }
        private void IncrementUserLoginAttempts(DataContext dataContext, DeviceHiveConfiguration configuration, User user)
        {
            var maxLoginAttempts = configuration.Authentication.MaxLoginAttempts;

            user.LoginAttempts++;
            if (maxLoginAttempts > 0 && user.LoginAttempts >= maxLoginAttempts)
                user.Status = (int)UserStatus.LockedOut;
            dataContext.User.Save(user);
        }
        public HostedAppServiceImpl(DeviceHiveConfiguration configuration, Router router)
        {
            var hosting = configuration.WebSocketEndpointHosting;
            if (string.IsNullOrEmpty(hosting.HostPipeName) || string.IsNullOrEmpty(hosting.AppPipeName))
                throw new ConfigurationErrorsException("Please specify hostPipeName and appPipeName in the webSocketEndpointHosting configuration element!");

            _service = new ApplicationService(hosting.HostPipeName, hosting.AppPipeName);
            _service.ConnectionOpened += (s, e) => router.HandleNewConnection(e.Connection);
            _service.MessageReceived += (s, e) => router.RouteRequest(e.Connection, e.Message);
            _service.ConnectionClosed += (s, e) => router.CleanupConnection(e.Connection);
        }
        public SelfHostServiceImpl(DeviceHiveConfiguration configuration, WebSocketServerBase server, Router router)
        {
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (server == null)
                throw new ArgumentNullException("server");
            if (router == null)
                throw new ArgumentNullException("router");

            _configuration = configuration;
            _server = server;
            _server.ConnectionOpened += (s, e) => router.HandleNewConnection(e.Connection);
            _server.MessageReceived += (s, e) => router.RouteRequest(e.Connection, e.Message);
            _server.ConnectionClosed += (s, e) => router.CleanupConnection(e.Connection);
        }
 public void Initialize(DeviceHiveConfiguration deviceHiveConfiguration)
 {
     _allowedSubnets = deviceHiveConfiguration.Maintenance.CronTriggerSubnets
         .Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries).Select(s => Subnet.ParseSubnet(s)).ToArray();
 }
 public AuthenticationFilter(DeviceHiveConfiguration deviceHiveConfiguration, IAuthenticationManager authenticationManager)
 {
     _deviceHiveConfiguration = deviceHiveConfiguration;
     _authenticationManager = authenticationManager;
 }