public GoogleProvider(string clientId, string clientSecret,
                              IList<string> scope = null,
                              IRestClientFactory restClientFactory = null)
        {
            if (string.IsNullOrEmpty(clientId))
            {
                throw new ArgumentNullException("clientId");
            }

            if (string.IsNullOrEmpty(clientSecret))
            {
                throw new ArgumentNullException("clientSecret");
            }

            _clientId = clientId;
            _clientSecret = clientSecret;

            // Optionals.
            _scope = scope == null ||
                     scope.Count <= 0
                         ? new List<string>
                         {
                             "https://www.googleapis.com/auth/userinfo.profile",
                             "https://www.googleapis.com/auth/userinfo.email"
                         }
                         : scope;
            _restClientFactory = restClientFactory ?? new RestClientFactory();
        }
Beispiel #2
0
 public JiraApiRequester(IRestClientFactory restClientFactory, IJiraApiRequestFactory jiraApiRequestFactory, IAuthenticator authenticator)
 {
     this.restClientFactory     = restClientFactory;
     this.jiraApiRequestFactory = jiraApiRequestFactory;
     this.restAuthenticator     = authenticator;
     ErrorMessage = "";
 }
 public LaunchpadRepository(IRestClientFactory restClientFactory, IRestRequestFactory restRequestFactory, IJsonResponseDeserializer deserializer, ILogger <BaseRepository> logger) : base(logger)
 {
     _restClientFactory  = restClientFactory;
     _restRequestFactory = restRequestFactory;
     _deserializer       = deserializer;
     _baseUrl            = Environment.GetEnvironmentVariable("SPACEX_API_BASE_URL");
 }
        public void Initialize(ProviderConfiguration providerConfiguration, IList<string> scope = null, IRestClientFactory restClientFactory = null)
        {
            if (providerConfiguration == null)
            {
                throw new ArgumentNullException("providerConfiguration");
            }

            if (providerConfiguration.Providers == null)
            {
                throw new ArgumentException("providerConfiguration.Providers");
            }

            foreach (ProviderKey provider in providerConfiguration.Providers)
            {
                IAuthenticationProvider authenticationProvider;
                switch (provider.Name.ToLowerInvariant())
                {
                    case "facebook":
                        authenticationProvider = new FacebookProvider(provider, scope, restClientFactory);
                        break;
                    case "google":
                        authenticationProvider = new GoogleProvider(provider, scope, restClientFactory);
                        break;
                    case "twitter":
                        authenticationProvider = new TwitterProvider(provider, restClientFactory);
                        break;
                    default:
                        throw new ApplicationException(
                            "Unhandled ProviderName found - unable to know which Provider Type to create.");
                }

                AddProvider(authenticationProvider);
            }
        }
Beispiel #5
0
 public PokeAPIClient(string baseURL, IRestClientFactory restClientFactory, IRestRequestFactory restRequestFactory)
 {
     BaseURL            = baseURL;
     RestClientFactory  = restClientFactory;
     RestRequestFactory = restRequestFactory;
     Limiter            = InitializeLimiter();
 }
 public QueuedAuditingHostedService(IRestClientFactory restFactory, string baseUrl, ILogger <QueuedAuditingHostedService> logger, IBackgroundAuditTaskQueue backgroundTaskQueue)
 {
     this.RestFactory         = restFactory;
     this.BackgroundTaskQueue = backgroundTaskQueue;
     this.BaseUrl             = baseUrl;
     this.Logger = logger;
 }
Beispiel #7
0
 public MatchGenerator(IRestClientFactory restClientFactory, IGameRepository gameRepository,
                       IRiotModelMapper riotModelMapper, IOptionsMonitor <Settings> options)
 {
     _client          = restClientFactory.CreateRestClient(options.CurrentValue.RiotApiUrl, options.CurrentValue.RiotApiToken);
     _gameRepository  = gameRepository;
     _riotModelMapper = riotModelMapper;
 }
Beispiel #8
0
 public JobProfileApi(IRestClientFactory restClientFactory, IRestRequestFactory restRequestFactory, AppSettings appSettings, APISettings apiSettings)
 {
     this.restClientFactory  = restClientFactory;
     this.restRequestFactory = restRequestFactory;
     this.appSettings        = appSettings;
     this.apiSettings        = apiSettings;
 }
Beispiel #9
0
 public PatchPipeline(IGameRepository gameRepository, IRestClientFactory restClientFactory,
                      IOptionsMonitor <Settings> options, ILogger <PatchPipeline> log)
 {
     _gameRepository = gameRepository;
     _log            = log;
     _client         = restClientFactory.CreateRestClient(options.CurrentValue.StaticDataEndpoint, string.Empty);
 }
        internal FacebookProvider(ProviderConfig config, IRestClientFactory restClientFactory, string defaultRedirectTemplate, string defaultCallbackTemplate) : base(config, defaultRedirectTemplate, defaultCallbackTemplate)
        {
            // Todo: If not all methods need client, perhaps don't always init it
            _restClient = restClientFactory.Create(_baseUrl);

            _apiDetails = config.Api;
        }
Beispiel #11
0
 public SearchService(IGoogleApiFactory googleApiFactory, IRestClientFactory restClientFactory, IYahooRequestFactory yahooRequestFactory, IOptions <EbayApiConfiguration> ebaySettings)
 {
     _googleApiFactory    = googleApiFactory;
     _restClientFactory   = restClientFactory;
     _yahooRequestFactory = yahooRequestFactory;
     _ebaySettings        = ebaySettings;
 }
Beispiel #12
0
        public SolutionsExDatastore(
            IRestClientFactory crmConnectionFactory,
            ILogger <SolutionsExDatastore> logger,
            ISyncPolicyFactory policy,

            ISolutionsDatastore solutionDatastore,
            ITechnicalContactsDatastore technicalContactDatastore,

            ICapabilitiesImplementedDatastore claimedCapabilityDatastore,
            ICapabilitiesImplementedEvidenceDatastore claimedCapabilityEvidenceDatastore,
            ICapabilitiesImplementedReviewsDatastore claimedCapabilityReviewsDatastore,

            IStandardsApplicableDatastore claimedStandardDatastore,
            IStandardsApplicableEvidenceDatastore claimedStandardEvidenceDatastore,
            IStandardsApplicableReviewsDatastore claimedStandardReviewsDatastore,

            IConfiguration config) :
            base(crmConnectionFactory, logger, policy, config)
        {
            _solutionDatastore         = solutionDatastore;
            _technicalContactDatastore = technicalContactDatastore;

            _claimedCapabilityDatastore         = claimedCapabilityDatastore;
            _claimedCapabilityEvidenceDatastore = claimedCapabilityEvidenceDatastore;
            _claimedCapabilityReviewsDatastore  = claimedCapabilityReviewsDatastore;

            _claimedStandardDatastore         = claimedStandardDatastore;
            _claimedStandardEvidenceDatastore = claimedStandardEvidenceDatastore;
            _claimedStandardReviewsDatastore  = claimedStandardReviewsDatastore;
        }
Beispiel #13
0
 public IntegrationApiClient(
     IRestClientFactory clientFactory,
     string baseUrl,
     AuthorityDetails authDetails,
     ILogger <IntegrationApiClient> logger)
     : base(clientFactory, baseUrl, authDetails, logger)
 {
 }
 public ReviewsDatastoreBase(
     IRestClientFactory crmFactory,
     ILogger <DatastoreBase <T> > logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmFactory, logger, policy, config)
 {
 }
 public CapabilitiesImplementedEvidenceDatastore(
     IRestClientFactory crmFactory,
     ILogger <DatastoreBase <CapabilitiesImplementedEvidence> > logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmFactory, logger, policy, config)
 {
 }
Beispiel #16
0
 public StandardsApplicableDatastore(
     IRestClientFactory crmConnectionFactory,
     ILogger <StandardsApplicableDatastore> logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmConnectionFactory, logger, policy, config)
 {
 }
 public StandardsApplicableReviewsDatastore(
     IRestClientFactory crmFactory,
     ILogger <DatastoreBase <StandardsApplicableReviews> > logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmFactory, logger, policy, config)
 {
 }
Beispiel #18
0
 public DummyEvidenceDatastoreBase(
     IRestClientFactory crmFactory,
     ILogger <DatastoreBase <EvidenceBase> > logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmFactory, logger, policy, config)
 {
 }
Beispiel #19
0
 public CapabilitiesImplementedDatastore(
     IRestClientFactory crmConnectionFactory,
     ILogger <CapabilitiesImplementedDatastore> logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmConnectionFactory, logger, policy, config)
 {
 }
Beispiel #20
0
 public SolutionsDatastore(
     IRestClientFactory crmConnectionFactory,
     ILogger <SolutionsDatastore> logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmConnectionFactory, logger, policy, config)
 {
 }
Beispiel #21
0
 public void Setup()
 {
     _authenticator     = Substitute.For <IAuthenticator>();
     _clientFactory     = Substitute.For <IRestClientFactory>();
     _requestFactory    = Substitute.For <IRequestFactory>();
     _eventWriter       = Substitute.For <IExternalEventWriter>();
     _responseValidator = Substitute.For <IResponseValidator>();
 }
 public WeatherAPI(IErrorLogger errorLogger,
                   IRestClientFactory restClientFactory,
                   IRestRequestFactory restRequestFactory)
 {
     _errorLogger        = errorLogger;
     _restRequestFactory = restRequestFactory;
     _restClientFactory  = restClientFactory;
 }
 public DummyReviewsDatastoreBase(
     IRestClientFactory dbConnectionFactory,
     ILogger <ReviewsDatastoreBase <ReviewsBase> > logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(dbConnectionFactory, logger, policy, config)
 {
 }
Beispiel #24
0
 public TechnicalContactsDatastore(
     IRestClientFactory crmConnectionFactory,
     ILogger <TechnicalContactsDatastore> logger,
     ISyncPolicyFactory policy,
     IConfiguration config) :
     base(crmConnectionFactory, logger, policy, config)
 {
 }
Beispiel #25
0
 public TimeRecordAPIClient(IRestClientFactory restClientFactory, IUserAPIClient userAPIClient, IHttpContextAccessor httpContextAccessor)
 {
     _restClientFactory = restClientFactory;
     _restClient        = _restClientFactory.CreateClient();
     _userAPIClient     = userAPIClient;
     _httpContext       = httpContextAccessor.HttpContext;
     _apiToken          = GetToken();
 }
Beispiel #26
0
        public GitHubOAuthAuthorizer(IRestClientFactory factory,
                                     IResponseProcessor processor)
        {
            Requires.ArgumentNotNull(factory, "factory");
            Requires.ArgumentNotNull(processor, "processor");

            _factory = factory;
            _processor = processor;
        }
        public CovidDataProvider(IRestClientFactory restClientFactory, IConfiguration configuration, ILogger <CovidDataProvider> logger)
        {
            _configuration = configuration;
            _logger        = logger;

            var dataSourceUrl = configuration["covidStatisticsUrl"];

            _restClient = restClientFactory.Create(dataSourceUrl);
        }
 public TwitterApiService(
     IRestClientFactory restClientFactory,
     IRestRequestFactory restRequestFactory,
     TwitterAccessTokenProvider accessTokenProvider)
 {
     this.restClientFactory   = restClientFactory;
     this.restRequestFactory  = restRequestFactory;
     this.accessTokenProvider = accessTokenProvider;
 }
Beispiel #29
0
        public TeamsPublisher(IContainer factory)
        {
            _factory = factory;

            _restClientFactory = _factory.Resolve<IRestClientFactory>();

            var flowBaseUrl = ConfigurationManager.AppSettings["FlowBaseURL"];
            _restClient = _restClientFactory.Create(new Uri(flowBaseUrl));
        }
 public GooglePlacesAPI(
     IErrorLogger errorLogger,
     IRestClientFactory restClientFactory,
     IRestRequestFactory restRequestFactory)
 {
     _errorLogger        = errorLogger;
     _restRequestFactory = restRequestFactory;
     _restClientFactory  = restClientFactory;
 }
 public StandardsDatastore(
     IRestClientFactory crmConnectionFactory,
     ILogger <StandardsDatastore> logger,
     ISyncPolicyFactory policy,
     IConfiguration config,
     IDatastoreCache cache) :
     base(crmConnectionFactory, logger, policy, config, cache)
 {
 }
Beispiel #32
0
        public GitHubOAuthAuthorizer(IRestClientFactory factory,
                                     IResponseProcessor processor)
        {
            Requires.ArgumentNotNull(factory, "factory");
            Requires.ArgumentNotNull(processor, "processor");

            _factory   = factory;
            _processor = processor;
        }
 public CapabilityStandardDatastore(
     IRestClientFactory crmFactory,
     ILogger <DatastoreBase <CapabilityStandard> > logger,
     ISyncPolicyFactory policy,
     IConfiguration config,
     IDatastoreCache cache) :
     base(crmFactory, logger, policy, config, cache)
 {
 }
        public MeetupProvider(
            IRestClientFactory restClientFactory,
            IRestRequestFactory restRequestFactory,
            ISecureCredentialsProvider apiKeyProvider)
        {
            this.restClientFactory = restClientFactory;

            this.restRequestFactory = restRequestFactory;

            this.apiKeyProvider = apiKeyProvider;
        }
        public BitBucketProvider(string consumerKey, string consumerSecret, IRestClientFactory restClientFactory = null)
        {
            if (string.IsNullOrEmpty(consumerKey))
            {
                throw new ArgumentNullException("consumerKey");
            }

            if (string.IsNullOrEmpty(consumerSecret))
            {
                throw new ArgumentNullException("consumerSecret");
            }

            _consumerKey = consumerKey;
            _consumerSecret = consumerSecret;

            // IRestClientFactory can be optional.
            _restClientFactory = restClientFactory ?? new RestClientFactory();
        }
Beispiel #36
0
        public FlickrProvider(string consumerKey
            , string consumerSecret
            , string perms = null
            , IRestClientFactory restClientFactory = null)
        {
            if (string.IsNullOrEmpty(consumerKey))
            {
                throw new ArgumentNullException("consumerKey");
            }

            if (string.IsNullOrEmpty(consumerSecret))
            {
                throw new ArgumentNullException("consumerSecret");
            }

            _consumerKey = consumerKey;
            _consumerSecret = consumerSecret;
            _restClientFactory = restClientFactory ?? new RestClientFactory();

            _perms = perms ?? "read";
        }
        public FacebookProvider(string clientId,
                                string clientSecret,
                                IList<string> scope = null,
                                IRestClientFactory restClientFactory = null)
        {
            if (string.IsNullOrEmpty(clientId))
            {
                throw new ArgumentNullException("clientId");
            }

            if (string.IsNullOrEmpty(clientSecret))
            {
                throw new ArgumentNullException("clientSecret");
            }

            _clientId = clientId;
            _clientSecret = clientSecret;

            // Optionals.
            _scope = scope ?? new List<string> {"email"};
            _restClientFactory = restClientFactory ?? new RestClientFactory();
        }
 public BaseProvider()
 {
     RestClientFactory = new RestClientFactory();
 }
 public OpenIdProvider(CustomProviderParams providerParams)
 {
     _restClientFactory = providerParams.RestClientFactory ?? new RestClientFactory();
 }
 private GitHubOAuthAuthorizer CreateAuthorizer(IRestClientFactory factory = null,
                                                IResponseProcessor processor = null)
 {
     return new GitHubOAuthAuthorizer(factory ?? new Mock<IRestClientFactory>(MockBehavior.Strict).Object,
                                      processor ?? new Mock<IResponseProcessor>(MockBehavior.Strict).Object);
 }
 public AuthenticationService(ProviderConfiguration providerConfiguration,
                              IList<string> scope = null, IRestClientFactory restClientFactory = null)
 {
     Initialize(providerConfiguration, scope, restClientFactory);
 }
 public BitBucketProvider(CustomProviderParams providerParams)
 {
     _consumerKey = providerParams.Key;
     _consumerSecret = providerParams.Secret;
     _restClientFactory = providerParams.RestClientFactory ?? new RestClientFactory();
 }
 public FacebookProvider(ProviderKey providerKey,
                         IList<string> scope = null,
                         IRestClientFactory restClientFactory = null) :
                             this(providerKey.Key, providerKey.Secret, scope, restClientFactory)
 {
 }
Beispiel #44
0
 public RestaurantService(IRestClientFactory restClientFactory, IRestRequestFactory restRequestFactory)
 {
     this.restClientFactory = restClientFactory;
     this.restRequestFactory = restRequestFactory;
 }
Beispiel #45
0
 public FlickrProvider(ProviderKey providerKey
     , string perms = null
     , IRestClientFactory restClientFactory = null)
     : this(providerKey.Key, providerKey.Secret, perms, restClientFactory)
 {
 }
 public TwitterProvider(ProviderKey providerKey, IRestClientFactory restClientFactory = null)
     : this(providerKey.Key, providerKey.Secret, restClientFactory)
 {
 }
Beispiel #47
0
 private GitHubClient CreateClient(IRestClientFactory factory = null,
     IResponseProcessor processor = null)
 {
     if (processor == null) {
         GitHubException ex = null;
         var mockProcessor = new Mock<IResponseProcessor>(MockBehavior.Strict);
         mockProcessor.Setup(p => p.TryProcessResponseErrors(It.IsAny<IGitHubResponse>(),
                                                             out ex))
                      .Returns(false);
         processor = mockProcessor.Object;
     }
     return new GitHubClient(factory ?? new Mock<IRestClientFactory>(MockBehavior.Strict).Object,
                             processor);
 }
        public PostcodeService(IRestClientFactory restClientFactory, IRestRequestFactory restRequestFactory)
        {
            this.restClientFactory = restClientFactory;

            this.restRequestFactory = restRequestFactory;
        }
 public GitHubProvider(CustomProviderParams providerParams)
 {
     _clientId = providerParams.Key;
     _clientSecret = providerParams.Secret;
     _restClientFactory = providerParams.RestClientFactory ?? new RestClientFactory();
 }
 public GitHubProvider(string clientId, string clientSecret, IRestClientFactory restClientFactory)
 {
     _clientId = clientId;
     _clientSecret = clientSecret;
     _restClientFactory = restClientFactory ?? new RestClientFactory();
 }
 public OpenIdProvider(IRestClientFactory restClientFactory = null)
 {
     _restClientFactory = restClientFactory;
 }
Beispiel #52
0
 public LeagueClient(IDota2ClientConfiguration config, IRestClientFactory clientFactory)
     : base(config, clientFactory) {}