public ClientAuthorizationProvider(IAsyncHttpClient httpClient, string Id, string secret)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }
            if (Id == null)
            {
                throw new ArgumentNullException(nameof(Id));
            }
            if (secret == null)
            {
                throw new ArgumentNullException(nameof(secret));
            }

            var request = new TokenRequest
            {
                ClientId     = Id,
                ClientSecret = secret,
                GrantType    = vGrantType
            };
            Uri tokenUri = httpClient.CreateRequestUri(vTokenEndpoint);
            var response = httpClient.PostAsync <TokenRequest, Token>(tokenUri, request).Result;

            Token = response.AccessToken;
        }
예제 #2
0
        public ConnectionManager(ILogger logger,
                                 ICredentialProvider credentialProvider,
                                 INetworkConnection networkConnectivity,
                                 IServerLocator serverDiscovery,
                                 string applicationName,
                                 string applicationVersion,
                                 IDevice device,
                                 ClientCapabilities clientCapabilities,
                                 ICryptographyProvider cryptographyProvider,
                                 Func <IClientWebSocket> webSocketFactory = null,
                                 ILocalAssetManager localAssetManager     = null)
        {
            _credentialProvider  = credentialProvider;
            _networkConnectivity = networkConnectivity;
            _logger               = logger;
            _serverDiscovery      = serverDiscovery;
            _httpClient           = AsyncHttpClientFactory.Create(logger);
            ClientCapabilities    = clientCapabilities;
            _webSocketFactory     = webSocketFactory;
            _cryptographyProvider = cryptographyProvider;
            _localAssetManager    = localAssetManager;

            Device               = device;
            ApplicationVersion   = applicationVersion;
            ApplicationName      = applicationName;
            ApiClients           = new Dictionary <string, IApiClient>(StringComparer.OrdinalIgnoreCase);
            SaveLocalCredentials = true;

            Device.ResumeFromSleep += Device_ResumeFromSleep;

            var jsonSerializer = new NewtonsoftJsonSerializer();

            _connectService = new ConnectService(jsonSerializer, _logger, _httpClient, _cryptographyProvider, applicationName, applicationVersion);
        }
예제 #3
0
        public ConnectionManager(ILogger logger,
            ICredentialProvider credentialProvider,
            INetworkConnection networkConnectivity,
            IServerLocator serverDiscovery,
            string applicationName,
            string applicationVersion,
            IDevice device,
            ClientCapabilities clientCapabilities,
            ICryptographyProvider cryptographyProvider,
            Func<IClientWebSocket> webSocketFactory = null,
            ILocalAssetManager localAssetManager = null)
        {
            _credentialProvider = credentialProvider;
            _networkConnectivity = networkConnectivity;
            _logger = logger;
            _serverDiscovery = serverDiscovery;
            _httpClient = AsyncHttpClientFactory.Create(logger);
            ClientCapabilities = clientCapabilities;
            _webSocketFactory = webSocketFactory;
            _cryptographyProvider = cryptographyProvider;
            _localAssetManager = localAssetManager;

            Device = device;
            ApplicationVersion = applicationVersion;
            ApplicationName = applicationName;
            ApiClients = new Dictionary<string, IApiClient>(StringComparer.OrdinalIgnoreCase);
            SaveLocalCredentials = true;

            Device.ResumeFromSleep += Device_ResumeFromSleep;

            var jsonSerializer = new NewtonsoftJsonSerializer();
            _connectService = new ConnectService(jsonSerializer, _logger, _httpClient, _cryptographyProvider, applicationName, applicationVersion);
        }
예제 #4
0
 private  RepositoryFactory(IAsyncHttpClient authorizedHttpClient)
 {
     if (authorizedHttpClient==null)
     throw new ArgumentNullException(nameof(authorizedHttpClient));
     if (!authorizedHttpClient.IsAuthorized)
         throw new ArgumentException(nameof(authorizedHttpClient) + $" is not authorized.");
     vClient = authorizedHttpClient;
 }
예제 #5
0
 public HomeController(
     ILogger <HomeController> logger,
     IAsyncHttpClient httpClient,
     IAuthService authService)
 {
     this.logger      = logger;
     this.httpClient  = httpClient;
     this.authService = authService;
 }
예제 #6
0
 public ConnectService(IJsonSerializer jsonSerializer, ILogger logger, IAsyncHttpClient httpClient, ICryptographyProvider cryptographyProvider, string appName, string appVersion)
 {
     JsonSerializer        = jsonSerializer;
     _logger               = logger;
     _httpClient           = httpClient;
     _cryptographyProvider = cryptographyProvider;
     _appName              = appName;
     _appVersion           = appVersion;
 }
예제 #7
0
 public SeederController(
     UserManager <LangMateUser> userManager,
     RoleManager <LangMateRole> roleManager,
     IAsyncHttpClient httpClient,
     ILanguagesService languagesService,
     IAuthService authService)
 {
     this.userManager      = userManager;
     this.roleManager      = roleManager;
     this.httpClient       = httpClient;
     this.languagesService = languagesService;
     this.authService      = authService;
 }
예제 #8
0
        protected BaseClient(ICryptographyProvider cryptographyProvider, IJsonSerializer jsonSerializer, IAsyncHttpClient httpClient, ILogger <T> logger)
        {
            CryptographyProvider = cryptographyProvider;
            JsonSerializer       = jsonSerializer;
            HttpClient           = httpClient;
            Logger = logger;

            ClientName         = Constants.AppName;
            ApplicationVersion = "1.0.0";
            Device             = new Device
            {
                DeviceId   = Constants.DeviceId,
                DeviceName = Constants.DeviceName
            };

            ResetHttpHeaders();
        }
예제 #9
0
        public ConnectionManager(ILogger logger,
                                 ICredentialProvider credentialProvider,
                                 INetworkConnection networkConnectivity,
                                 IServerLocator serverDiscovery,
                                 string applicationName,
                                 string applicationVersion,
                                 IDevice device,
                                 ClientCapabilities clientCapabilities,
                                 Func <IClientWebSocket> webSocketFactory = null)
        {
            _credentialProvider  = credentialProvider;
            _networkConnectivity = networkConnectivity;
            _logger            = logger;
            _serverDiscovery   = serverDiscovery;
            _httpClient        = AsyncHttpClientFactory.Create(logger);
            ClientCapabilities = clientCapabilities;
            _webSocketFactory  = webSocketFactory;

            Device               = device;
            ApplicationVersion   = applicationVersion;
            ApplicationName      = applicationName;
            ApiClients           = new Dictionary <string, IApiClient>(StringComparer.OrdinalIgnoreCase);
            SaveLocalCredentials = true;
        }
예제 #10
0
 protected BaseLocalPlayer(INetworkConnection network, IAsyncHttpClient httpClient)
 {
     Network = network;
     HttpClient = httpClient;
     network.NetworkChanged += network_NetworkChanged;
 }
예제 #11
0
 public PortablePlayer(INetworkConnection network, IAsyncHttpClient httpClient)
     : base(network, httpClient)
 {
 }
예제 #12
0
 public PortablePlayer(INetworkConnection network, IAsyncHttpClient httpClient)
     : base(network, httpClient)
 {
 }
예제 #13
0
 internal BaseRepository(IAsyncHttpClient authorizedHttpClient, string endpoint)
 {
     vHttpClient = authorizedHttpClient ?? throw new ArgumentNullException(nameof(authorizedHttpClient));
     vEndpoint   = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
 }
예제 #14
0
 public UsersProvider(IAsyncHttpClient client, BSIdentityManager bsIdentityManager)
 {
     _client            = client;
     _bsIdentityManager = bsIdentityManager;
 }
예제 #15
0
 protected BaseLocalPlayer(INetworkConnection network, IAsyncHttpClient httpClient)
 {
     Network                 = network;
     HttpClient              = httpClient;
     network.NetworkChanged += network_NetworkChanged;
 }
예제 #16
0
 public LocalPlayer(INetworkConnection network, IAsyncHttpClient httpClient)
     : base(network, httpClient)
 {
 }
예제 #17
0
 public EmbyClient(ICryptographyProvider cryptographyProvider, IJsonSerializer jsonSerializer, IAsyncHttpClient httpClient, ILogger <EmbyClient> logger)
     : base(cryptographyProvider, jsonSerializer, httpClient, logger)
 {
 }
예제 #18
0
 internal CommentRepository(IAsyncHttpClient authorizedHttpClient, string endpoint) : base(authorizedHttpClient, endpoint)
 {
 }
예제 #19
0
 public LocalPlayer(INetworkConnection network, IAsyncHttpClient httpClient)
     : base(network, httpClient)
 {
 }
예제 #20
0
 public RolesService(IUnitOfWork unitOfWork, IAsyncHttpClient httpClient, IUsersService userService)
 {
     _unitOfWork  = unitOfWork;
     _httpClient  = httpClient;
     _userService = userService;
 }