Beispiel #1
0
 public ServiceFactory(IClientService clientService, ITokenService tokenService, IResourceOwnerService resourceOwnerService, IAuthorizationGrantService authorizationGrantService)
 {
     ClientService = clientService;
     TokenService = tokenService;
     ResourceOwnerService = resourceOwnerService;
     AuthorizationGrantService = authorizationGrantService;
 }
        /// <summary>
        /// Sets the content of the request by the given body and the the required GZip configuration.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <param name="service">The service.</param>
        /// <param name="body">The body of the future request. If <c>null</c> do nothing.</param>
        /// <param name="gzipEnabled">
        /// Indicates if the content will be wrapped in a GZip stream, or a regular string stream will be used.
        /// </param>
        internal static void SetRequestSerailizedContent(this HttpRequestMessage request,
            IClientService service, object body, bool gzipEnabled)
        {
            if (body == null)
            {
                return;
            }
            HttpContent content = null;

            var mediaType = "application/" + service.Serializer.Format;
            var serializedObject = service.SerializeObject(body);
            if (gzipEnabled)
            {
                content = CreateZipContent(serializedObject);
                content.Headers.ContentType = new MediaTypeHeaderValue(mediaType)
                {
                    CharSet = Encoding.UTF8.WebName
                };
            }
            else
            {
                content = new StringContent(serializedObject, Encoding.UTF8, mediaType);
            }

            request.Content = content;
        }
 /// <summary>
 /// Creates a suitable exception for an HTTP response, attempting to parse the body as
 /// JSON but falling back to just using the text as the message.
 /// </summary>
 internal static async Task<GoogleApiException> ExceptionForResponseAsync(
     IClientService service,
     HttpResponseMessage response)
 {
     // If we can't even read the response, let that exception bubble up, just as it would have done
     // if the error had been occurred when sending the request.
     string responseText = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
     RequestError parsedError = null;
     string message = responseText;
     try
     {
         var parsedResponse = service.Serializer.Deserialize<StandardResponse<object>>(responseText);
         if (parsedResponse != null && parsedResponse.Error != null)
         {
             parsedError = parsedResponse.Error;
             message = parsedError.ToString();
         }
     }
     catch (JsonException)
     {
         // Just make do with a null RequestError, and the message set to the body of the response.
         // The contents of the caught exception aren't particularly useful - we don't need to include it
         // as a cause, for example. The expectation is that the exception returned by this method (below)
         // will be thrown by the caller.
     }
     return new GoogleApiException(service.Name, message)
     {
         Error = parsedError,
         HttpStatusCode = response.StatusCode
     };
 }
 public LiveCheckController(
     IClientService clientService,
     ISiteService siteService)
 {
     _clientService = clientService;
     _siteService = siteService;
 }
        public static AuthorizeRequestValidator CreateAuthorizeValidator(
            CoreSettings settings = null,
            IScopeService scopes = null,
            IClientService clients = null,
            IUserService users = null,
            ICustomRequestValidator customValidator = null)
        {
            if (settings == null)
            {
                settings = new TestSettings();
            }

            if (scopes == null)
            {
                scopes = new InMemoryScopeService(TestScopes.Get());
            }

            if (clients == null)
            {
                clients = new InMemoryClientService(TestClients.Get());
            }

            if (customValidator == null)
            {
                customValidator = new DefaultCustomRequestValidator();
            }

            if (users == null)
            {
                users = new TestUserService();
            }

            return new AuthorizeRequestValidator(settings, scopes, clients, users, customValidator);
        }
 public HomeController()
 {
     ProductService = new ProductService();
     ShoppingListService = new ShoppingListService();
     ClientService = new ClientService();
     ItemShoppingService = new ItemShoppingService();
 }
 public AccountController(IClientService clientService, IRoleService roleService, IUtilisateurService<Client> utilisateurService, IImageService imageService)
 {
     ClientService = clientService;
     RoleService = roleService;
     UtilisateurService = utilisateurService;
     ImageService = imageService;
 }
Beispiel #8
0
        private const string LED_CODE = "LED"; // LED equipment code

        #endregion Fields

        #region Methods

        private static void HandleNotifications(IClientService service, Device device, CancellationToken token)
        {
            try
            {
                var timestamp = DateTime.UtcNow;
                while (true)
                {
                    // poll notification from the server
                    var notifications = service.PollNotifications(device.Id.Value, timestamp, token);
                    if (notifications == null)
                        continue;

                    // display information about received notification
                    foreach (var notification in notifications.Where(n =>
                        n.Name == "equipment" && n.GetParameter("equipment") == LED_CODE))
                    {
                        var message = "Device sent LED state change notification, new state: {0}";
                        Console.WriteLine(string.Format(message, notification.GetParameter("state")));
                    }

                    // update last received notification timestamp
                    timestamp = notifications.Max(n => n.Timestamp.Value);
                }
            }
            catch (OperationCanceledException)
            {
                return;
            }
        }
Beispiel #9
0
		public PaymentService(JudoPayApi judoAPI, Judo judo)
		{
			_judoAPI = judoAPI;
			_judo = judo;
			clientService = DependencyService.Get<IClientService>();
			CycleSession();
		}
 public void Initialize()
 {
     _ninjectKernel = new StandardKernel(new Modules.MockRepositoryModule());
     _ninjectKernel.Bind<IClientService>().To<ClientService>();
     _service = _ninjectKernel.Get<IClientService>();
     //var dataGenerator = new DataGenerator();
     //dataGenerator.InitializeContext();
 }
 public ActionTriggerClient(IClientService clientService, IConfiguration configuration, IServerStatusService serverStatusService,
                            IActionServiceHost actionServiceHost, IActionRegistry actionRegistry, ILog log)
     : base(clientService, configuration, serverStatusService, log)
 {
     _actionServiceHost = actionServiceHost;
     _actionRegistry = actionRegistry;
     Triggers = new List<Trigger>();
 }
Beispiel #12
0
 public DataGenerator()
 {
     _ninjectKernel = new StandardKernel(new Modules.MockRepositoryModule());
     _ninjectKernel.Bind<IClientService>().To<ClientService>();
     _ninjectKernel.Bind<IUserAccountService>().To<UserAccountService>();
     _clientService = _ninjectKernel.Get<IClientService>();
     _userAccountService = _ninjectKernel.Get<IUserAccountService>();
 }
Beispiel #13
0
 public WorkerClient(IClientService clientService, IConfiguration configuration, IServerStatusService serverStatusService,
                     IWorkflowEngine workflowEngine, ILog log, IWorkerLockManager workerLockManager, IWorkerServiceHost workerServiceHost)
     : base(clientService, configuration, serverStatusService, log)
 {
     _workflowEngine = workflowEngine;
     _workerLockManager = workerLockManager;
     _workerServiceHost = workerServiceHost;
 }
 public SiteUpdateCompositionGateway(
     IClientService clientService,
     IBus bus
     )
 {
     _clientService = clientService;
     _bus = bus;
 }
 public TokenValidator(CoreSettings settings, IUserService users, IClientService clients, ITokenHandleStore tokenHandles, ICustomTokenValidator customValidator)
 {
     _settings = settings;
     _users = users;
     _clients = clients;
     _tokenHandles = tokenHandles;
     _customValidator = customValidator;
 }
Beispiel #16
0
 public Client(IClientService clientService, IConfiguration configuration, IServerStatusService serverStatusService, ILog log)
 {
     State = State.Instanciated;
     _clientService = clientService;
     _configuration = configuration;
     _serverStatusService = serverStatusService;
     _log = log;
 }
Beispiel #17
0
		public NativeHandler(HttpMessageHandler innerHandler, Credentials credentials, ILog log, string apiVersionHeader, string apiVersionValue, IClientService clientService) : base(innerHandler)
		{
			_log = log;
			_credentials = credentials;
			_clientService = clientService;
			_apiVersionHeader = apiVersionHeader;
			_apiVersionValue = apiVersionValue;
		}
 public CompanyDetailsService(
     IClientService clientService,
     IPeninsulaLog log,
     IBus bus)
 {
     _clientService = clientService;
     _log = log;
     _bus = bus;
 }
        public ClientsController(ApiServices services, IUnitOfWork unitOfWork, IClientService clientService, IAccountService accountService)
            : base(services, unitOfWork)
        {
            Requires.NotNull(clientService, "clientService");
            _clientService = clientService;

            Requires.NotNull(accountService, "accountService");
            _accountService = accountService;
        }
 public AccountController(
     IBus bus,
     IAccountRepository accountRepository,
     IClientService clientService)
 {
     _bus = bus;
     _accountRepository = accountRepository;
     _clientService = clientService;
 }
        public static ClientValidator CreateClientValidator(
            IClientService clients = null)
        {
            if (clients == null)
            {
                clients = new InMemoryClientService(TestClients.Get());
            }

            return new ClientValidator(clients);
        }
Beispiel #22
0
 public LoginViewModel(IEventAggregator _events, IClientService _clientService)
 {
     events = _events;
     clientService = _clientService;
     initUserData();
     if (AutoLogin)
     {
         login();
     } 
 }
        public AuthorizeRequestValidator(CoreSettings core, IScopeService scopes, IClientService clients, IUserService users, ICustomRequestValidator customValidator)
        {
            _core = core;
            _scopes = scopes;
            _clients = clients;
            _users = users;
            _customValidator = customValidator;

            _validatedRequest = new ValidatedAuthorizeRequest();
            _validatedRequest.CoreSettings = _core;
        }
 private static string GetAccessToken(IClientService service)
 {
     try
     {
         return ((UserCredential)service.HttpClientInitializer).Token.AccessToken;
     }
     catch (NullReferenceException)
     {
         return null;
     }
 }
        public ScorecardsDepartmentsNodesPath(StratsysAuthentication authentication,
            Path path)
        {
            m_authentication = authentication;
            m_path = path;
            m_descriptionFieldValueService = new GenericService(authentication, path.Descriptionfields);
            m_nodeKeywordService = new GenericService(authentication, path.Keywords);
            m_nodeExternalPageService = new GenericService(authentication, path.ExternalPages);

            m_scorecardsDepartmentsNodesResponsibilityRolesPath =
                new ScorecardsDepartmentsNodesResponsibilityRolesPath(authentication, path.Resource("responsibilityroles"));
        }
 public EventhandlerClient(IClientService clientService,
     IConfiguration configuration,
     IServerStatusService serverStatusService,
     ILog log,
     IEventhandlingServiceHost eventhandlingServiceHost, IEventHandlingService eventHandlingService,
     IEventhandlingLockManager eventhandlingLockManager)
     : base(clientService, configuration, serverStatusService, log)
 {
     _eventhandlingServiceHost = eventhandlingServiceHost;
     _eventHandlingService = eventHandlingService;
     _eventhandlingLockManager = eventhandlingLockManager;
 }
Beispiel #27
0
 public ArticleViewModel(IClientService clientService)
 {
     _clientService = clientService;
     ArticleDto = new ArticleDto
     {
         Id = Guid.Empty,
         Created = DateTime.Today,
         Description = "",
         Text = "",
         Title = "Новая статья",
         Comments = new List<CommentDto>()
     };
     SubscribeToGuiMessages();
 }
        public static string CreateDomain(string sessionId, string ipaddress, DateTime time, IClientService clientService)
        {
            string clientId = Guid.NewGuid().ToString();

            try
            {
                AddClient(sessionId, clientId, ipaddress, time, clientService);
                return clientId;
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Source + ":创建客户端运行环境失败!");
            }
        }
        private void btnSauvegarder_Click(object sender, RoutedEventArgs e)
        {
            //Si aucun client, on va le chercher dans la base de données par son numéro de téléphone
            if (ViewModel.Soumission.Client == null)
            {
                _clientService = ServiceFactory.Instance.GetService<IClientService>();
                RetrieveClientArgs = new RetrieveClientArgs();
                RetrieveClientArgs.IdClient = 2;
                Client = _clientService.Retrieve(RetrieveClientArgs);
                MessageBox.Show(Client.Nom);
            }

            ViewModel.SauvegarderCommand();
        }
Beispiel #30
0
 public ClientController(IClientService clientService, ILocalizationService localizationService,
     ICountryService countryService, IStateProvinceService stateprovinceService, 
     IBranchOfficeService officeService, IGenericAttributeService attributeService, IUserActivityService userActivityService,
     IEncryptionService encryptionService, IWorkContext workContext, ICacheManager cacheManager )
 {
     this.clientService        = clientService;
     this.localizationService  = localizationService;
     this.officeService        = officeService;
     this.userActivityService  = userActivityService;
     this.encryptionService    = encryptionService;
     this.cacheManager         = cacheManager;
     this.countryService       = countryService;
     this.stateprovinceService = stateprovinceService;
     this.workContext          = workContext;
     this.attributeService     = attributeService;
 }