public InMemoryTokenManager(ITokenRetriever tokenRetriever, ICredentialProvider credentialProvider)
        {
            _tokenRetriever = tokenRetriever;
            _credential     = credentialProvider.GenerateCredential();

            _memoryTokens = new ConcurrentDictionary <ApplicationCredential, ApplicationToken>();
        }
Example #2
0
 public OdsRestClient(OdsApiConnectionInformation connectionInformation, IRestClient restClient, ITokenRetriever tokenRetriever)
 {
     _connectionInformation = connectionInformation;
     _tokenRetriever        = tokenRetriever;
     _restClient            = restClient;
     _logger = LogManager.GetLogger(typeof(OdsRestClient));
 }
 public InMemoryTokenManager(ITokenRetriever tokenRetriever, ICredentialProvider credentialProvider)
 {
     _tokenRetriever = tokenRetriever;
     _credential = credentialProvider.GenerateCredential();
     
     _memoryTokens = new ConcurrentDictionary<ApplicationCredential, ApplicationToken>();
 }
 public FileImportService(FileImportConfiguration configuration, string instanceName)
 {
     _configuration  = configuration;
     _tokenRetriever = new TokenRetriever(new OdsApiConnectionInformation(instanceName, CloudOdsAdminAppSettings.Instance.Mode)
     {
         OAuthUrl     = configuration.OauthUrl,
         ClientKey    = configuration.OauthKey,
         ClientSecret = configuration.OauthSecret
     });
 }
        public FileImportService(IConfiguration configuration, string instanceName, IInferOdsApiVersion inferOdsApiVersion)
        {
            _configuration      = configuration;
            _inferOdsApiVersion = inferOdsApiVersion;

            _tokenRetriever = new TokenRetriever(new OdsApiConnectionInformation(instanceName, CloudOdsAdminAppSettings.Instance.Mode)
            {
                OAuthUrl     = _configuration.GetValue <string>("OdsApi:OAuthUrl"),
                ClientKey    = _configuration.GetValue <string>("OdsApi:Key"),
                ClientSecret = _configuration.GetValue <string>("OdsApi:Secret")
            });
        }
Example #6
0
        public DelegatedHttpMessageHandler(DelegatedHttpClientOptions options, IHttpContextAccessor httpContextAccessor,
                                           ITokenRetriever tokenRetriever, ILogger <DelegatedHttpMessageHandler> logger)
        {
            _options             = options;
            _httpContextAccessor = httpContextAccessor;
            _tokenRetriever      = tokenRetriever;
            _logger = logger;

            _tokenClient = new TokenClient("http://voidwellauth:5000/connect/token",
                                           ApiScope,
                                           "apiSecret",
                                           _options.TokenServiceMessageHandler ?? new HttpClientHandler(),
                                           AuthenticationStyle.BasicAuthentication);

            var handler = new HttpClientHandler();

            _httpMessageInvoker = new HttpMessageInvoker(handler,
                                                         _options.InnerMessageHandler == null || _options.DisposeInnerMessageHandler);
        }
 public void UpdateToken(ITokenRetriever tokenRetriever)
 {
     bearerToken = tokenRetriever.ObtainNewBearerToken();
 }
 public BearerTokenAuthenticator(ITokenRetriever tokenRetriever)
 {
     UpdateToken(tokenRetriever);
 }
 public OAuthTokenHandler(ITokenRetriever tokenRetriever)
 {
     _tokenRetriever = tokenRetriever;
 }