public DeleteOrphanedAVs(IApprenticeshipVacancyRepository apprenticeshipVacancyRepository, ITokenClient sitefinityTokenClient, IApplicationLogger logger, IAuditService auditService) { this.apprenticeshipVacancyRepository = apprenticeshipVacancyRepository; this.sitefinityTokenClient = sitefinityTokenClient; this.logger = logger; this.auditService = auditService; }
private HttpDao(string environmentId, ITokenClient tokenClient, HttpClient httpClient, string endPoint, string endPointMask, string countriesEndPoint, int updateInterval) { s_helper.Check <StorageClientException>(IsNullOrEmpty(environmentId), Messages.HttpDao.s_errNullEnvironmentId); s_helper.Check <StorageClientException>(tokenClient == null, Messages.HttpDao.s_errNullTokenClient); s_helper.Check <StorageClientException>(httpClient == null, Messages.HttpDao.s_errNullHttpClient); _environmentId = environmentId; _client = httpClient; _tokenClient = tokenClient; _isDefaultEndPoint = endPoint == null; _endPoint = endPoint ?? DefaultEndPoint; _endPointMask = endPointMask; CountriesEndPoint = countriesEndPoint ?? DefaultCountryEndPoint; _updateInterval = updateInterval; _jsonSettings = new JsonSerializerSettings { ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() }, Formatting = Formatting.None, NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Include }; if (_isDefaultEndPoint) { _popDictionary = LoadCountriesAsync().Result; } }
public SchemeOwnerClient(ITokenClient tokenClient, IConfiguration configuration, ILogger <SchemeOwnerClient> logger) { _logger = logger; _tokenClient = tokenClient; _schemeOwnerBaseUrl = configuration["SchemeOwner:BaseUri"]; _privateKey = configuration["MyDetails:PrivateKey"]; _publicKeys = configuration.GetSection("MyDetails:PublicKeys").Get <string[]>(); _clientId = configuration["MyDetails:ClientId"]; if (string.IsNullOrEmpty(_schemeOwnerBaseUrl)) { throw new SchemeOwnerClientException("The SchemeOwner Uri is not configured."); } if (string.IsNullOrEmpty(_privateKey)) { throw new SchemeOwnerClientException("The PrivateKey is not configured."); } if (string.IsNullOrEmpty(_clientId)) { throw new SchemeOwnerClientException("The ClientId is not configured."); } if (!_publicKeys.Any()) { throw new SchemeOwnerClientException("The Public Keys are not configured."); } }
public AuthorizationRegistryClient(ITokenClient tokenClient, IConfiguration configuration, ILogger <AuthorizationRegistryClient> logger) { _logger = logger; _tokenClient = tokenClient; _authorizationRegistryBaseUrl = configuration["AuthorizationRegistry:BaseUri"]; _privateKey = configuration["MyDetails:PrivateKey"]; _publicKeys = configuration.GetSection("MyDetails:PublicKeys").Get <string[]>(); _clientId = configuration["MyDetails:ClientId"]; if (string.IsNullOrEmpty(_authorizationRegistryBaseUrl)) { throw new AuthorizationRegistryClientException("The AuthorizationRegistry Uri is not configured."); } if (string.IsNullOrEmpty(_privateKey)) { throw new AuthorizationRegistryClientException("The PrivateKey is not configured."); } if (string.IsNullOrEmpty(_clientId)) { throw new AuthorizationRegistryClientException("The ClientId is not configured."); } if (!_publicKeys.Any()) { throw new AuthorizationRegistryClientException("The Public Keys are not configured."); } }
private ITokenClient GetClient() { if (_tokenClient != null) { return(_tokenClient); } try { _tokenClient = _tokenClientFactory.CreateClient(_tokenManagerOptions.Client); return(_tokenClient); } catch (TokenManagerException ex) { LogEntry(LogLevel.Error, ex.Message, ex); throw; } catch (Exception ex) { LogEntry(LogLevel.Error, ex.Message, ex); throw new TokenManagerException(ex.Message, ex); } }
public SitefinityODataContext(ITokenClient tokenClient, IHttpClientService httpClient, IApplicationLogger logger, IAuditService auditService) { this.tokenClient = tokenClient; httpClientService = httpClient; this.logger = logger; this.auditService = auditService; }
public TelegraphConnector(ILogger <TelegraphConnector> logger, IConfiguration configuration) { _configuration = configuration; _client = new Telegraph.Net.TelegraphClient(); _secureClient = _client.GetTokenClient(_configuration.GetSection("TelegraphApiKey").Value); _logger = logger; }
public TokenGrantTypeSelector(RequestBuilder requestBuilder, ITokenClient tokenClient, IIntrospectClient introspectClient, IRevokeTokenClient revokeTokenClient) { _requestBuilder = requestBuilder; _tokenClient = tokenClient; _introspectClient = introspectClient; _revokeTokenClient = revokeTokenClient; }
public UoStudioClientTokenHandler( ILogger logger, ITokenClient tokenClient) { _logger = logger.ForContext <UoStudioClientTokenHandler>(); _tokenClient = tokenClient; }
public TelegraphClient(ILogger <TelegraphClient> logger, ICoreLogicService coreLogicService, IConfiguration configuration) { _configuration = configuration; _client = new Telegraph.Net.TelegraphClient(); _secureClient = _client.GetTokenClient(_configuration.GetSection("TelegraphApiKey").Value); _logger = logger; _coreLogicService = coreLogicService; }
public UnauthorizedResponseHandler( ITokenClient tokenClient, ITokenStorage tokenStorage, IUserStorage userStorage) { _tokenClient = tokenClient; _tokenStorage = tokenStorage; _userStorage = userStorage; }
public AuthorizationRegistryClient(ITokenClient tokenClient, AuthorizationRegistryClientOptions authorizationRegistryClientOptions, PartyDetailsOptions partyDetailsOptions, ILogger <AuthorizationRegistryClient> logger) { _logger = logger; _tokenClient = tokenClient; _authorizationRegistryClientOptions = authorizationRegistryClientOptions; _partyDetailsOptions = partyDetailsOptions; }
private void InitializeFakeObjects() { _tokenRequestBuilderStub = new Mock <ITokenRequestBuilder>(); _postTokenOperationStub = new Mock <IPostTokenOperation>(); _getDiscoveryOperationStub = new Mock <IGetDiscoveryOperation>(); _tokenClient = new TokenClient( _tokenRequestBuilderStub.Object, _postTokenOperationStub.Object, _getDiscoveryOperationStub.Object); }
public SchemeOwnerClient(ITokenClient tokenClient, SchemeOwnerClientOptions schemeOwnerClientOptions, PartyDetailsOptions partyDetailsOptions, ILogger <SchemeOwnerClient> logger) { _logger = logger; _tokenClient = tokenClient; _schemeOwnerClientOptions = schemeOwnerClientOptions; _partyDetailsOptions = partyDetailsOptions; }
public ActionableFailureApiResultEventHandler(IModals modals, ApiActionModalViewModel apiActionModalViewModel, IApiClient apiClient, ITokenClient tokenClient) { _modals = modals; _apiActionModalViewModel = apiActionModalViewModel; apiClient.OnActionableFailureResult += OnActionableFailureResult; tokenClient.OnActionableFailureResult += OnActionableFailureResult; }
public AuthenticationManager( IConnectionManager connectionManager, ITokenClient tokenClient, ILogger <AuthenticationManager> logger) { this.connectionManager = connectionManager; this.tokenClient = tokenClient; this.logger = logger; this.saveFolder = PlatformUtilities.AppDataFolder(); this.saveAuthenticatedUserFile = Path.Combine(this.saveFolder, "authenticated-user.json"); }
public LoginViewModel( ITokenClient tokenClient, IPopupService popupService, INavigationService navigationService) { _tokenClient = tokenClient; _popupService = popupService; _navigationService = navigationService; LoginCommand = new Command(async() => await ExecuteLoginCommand()); }
public CustomApiContextService( IApplicationLogger applicationLogger, ITokenClient tokenClient, ICustomApiConfig customApiConfig, IHttpClientService httpClientService) { this.applicationLogger = applicationLogger; this.tokenClient = tokenClient; this.customApiConfig = customApiConfig; this.httpClientService = httpClientService; }
public CodeFlowAuthenticationHandler( IAuthorizeUrlBuilder authorizeUrlBuilder, INonceCache nonceCache, ITokenClient tokenClient, ITokenValidator tokenValidator, IUserInfoClient userInfoClient) { _authorizeUrlBuilder = authorizeUrlBuilder; _nonceCache = nonceCache; _tokenClient = tokenClient; _tokenValidator = tokenValidator; _userInfoClient = userInfoClient; }
public DisbursementsClient( DisbursementsConfig disbursementConfig, ITokenClient tokenClient, IAccountBalanceClient accountBalanceClient, IAccountHolderClient accountHolderClient, ITransferClient transferClient) { this.disbursementConfig = disbursementConfig; this.tokenClient = tokenClient; this.accountBalanceClient = accountBalanceClient; this.accountHolderClient = accountHolderClient; this.transferClient = transferClient; }
public RemittanceClient( RemittanceConfig remittanceConfig, ITokenClient tokenClient, IAccountBalanceClient accountBalanceClient, IAccountHolderClient accountHolderClient, ITransferClient transferClient) { this.remittanceConfig = remittanceConfig; this.tokenClient = tokenClient; this.accountBalanceClient = accountBalanceClient; this.accountHolderClient = accountHolderClient; this.transferClient = transferClient; }
public void TestInitialize() { _tokenClient = Substitute.For <ITokenClient>(); _tokenClient.RefreshTokenAsync(Arg.Any <CancellationToken>()) .Returns(ApiResponseResult <RefreshTokenResponse> .Ok(new RefreshTokenResponse())); _tokenStorage = Substitute.For <ITokenStorage>(); _tokenStorage.AccessToken.Returns("Access token"); _tokenStorage.RefreshToken.Returns("Refresh token"); _tokenStorage.Uid.Returns(string.Empty); _innerHandler = new MockHttpMessageHandler(); }
public CollectionClient( IBaseClient baseClient, CollectionConfig collectionConfig, ITokenClient tokenClient, IAccountBalanceClient accountBalanceClient, IAccountHolderClient accountHolderClient) { this.baseClient = baseClient; this.collectionConfig = collectionConfig; this.tokenClient = tokenClient; this.accountBalanceClient = accountBalanceClient; this.accountHolderClient = accountHolderClient; }
private static (string accessToken, ITokenClientFactory tokenClientFactory) MockTokenClientFactory() { var accessToken = Guid.NewGuid().ToString(); ITokenInfo tokenInfo = Substitute.For <ITokenInfo>(); tokenInfo.AccessToken.Returns(accessToken); ITokenClient tokenClient = Substitute.For <ITokenClient>(); tokenClient.GetTokenAsync(Arg.Any <bool>()).Returns(Result(tokenInfo)); ITokenClientFactory tokenClientFactory = Substitute.For <ITokenClientFactory>(); tokenClientFactory.GetTokenClient(IamClientOptions.IamTokenClientName).Returns(Result(tokenClient)); return(accessToken, tokenClientFactory); }
public static IDao NewDao(string environmentId, ITokenClient tokenClient, HttpClient httpClient, string endPoint = null, string endPointMask = null, string countriesEndPoint = DefaultCountryEndPoint, int updateInterval = DefaultUpdateInterval) { #pragma warning disable CA2000,CA1062 var dao = new HttpDao(environmentId, tokenClient, httpClient, endPoint, endPointMask, countriesEndPoint, updateInterval); #pragma warning restore CA2000,CA1062 var proxy = LogWrapper <IDao> .Create(dao, false); return(proxy); }
public void ExecuteDeviceAuthorizationAfterExpiry() { const string clientId = "device"; ITokenClient tokenClient = null !; DeviceAuthorizationResponse response = null !; "Given a token client".x( () => { tokenClient = new TokenClient( TokenCredentials.AsDevice(), _fixture.Client, new Uri(WellKnownOpenidConfiguration)); Assert.NotNull(tokenClient); }); "When a device requests authorization".x( async() => { var genericResponse = await tokenClient.GetAuthorization(new DeviceAuthorizationRequest(clientId)) .ConfigureAwait(false) as Option <DeviceAuthorizationResponse> .Result; Assert.NotNull(genericResponse); response = genericResponse.Item; }); Option <GrantedTokenResponse> expiredPoll = null !; "and the device polls the token server after expiry".x( async() => { expiredPoll = await tokenClient.GetToken( TokenRequest.FromDeviceCode(clientId, response.DeviceCode, 7)) .ConfigureAwait(false); }); "then error shows request expiry".x( async() => { Assert.IsType <Option <GrantedTokenResponse> .Error>(expiredPoll); Assert.Equal( ErrorCodes.ExpiredToken, (expiredPoll as Option <GrantedTokenResponse> .Error).Details.Title); }); }
public ShopifyService(IOptions <ShopifyOptions> shopifyOptions, IShopifyStoreService shopifyStoreService, ILogger logger, IHttpContextAccessor httpContextAccessor, INDAShopClient NDAShopClient, ITokenClient tokenClient, INDAAccountClient accountClient, IShopifyChargeStore shopifyChargeStore) { _shopifyStoreService = shopifyStoreService; _logger = logger; _httpContextAccessor = httpContextAccessor; _NDAShopClient = NDAShopClient; _tokenClient = tokenClient; _accountClient = accountClient; _shopifyChargeStore = shopifyChargeStore; _shopifyOptions = shopifyOptions.Value; }
public void TestInitialize() { _tokenClient = Substitute.For <ITokenClient>(); _tokenClient.RefreshTokenAsync(Arg.Any <CancellationToken>()) .Returns(ApiResponseResult <RefreshTokenResponse> .Ok(new RefreshTokenResponse())); _tokenStorage = Substitute.For <ITokenStorage>(); _tokenStorage.AccessToken.Returns("Access token"); _tokenStorage.RefreshToken.Returns("Refresh token"); _tokenStorage.Uid.Returns("User ID"); _userStorage = Substitute.For <IUserStorage>(); _userStorage.User().Returns(new Core.Models.User { Username = "******" }); _logger = Substitute.For <ILogger>(); _innerHandler = new MockHttpMessageHandler(); }
private Storage(StorageConfig config) { s_helper.Check <StorageClientException>(config == null, Messages.Storage.s_errNullConfig); _httpClient = new HttpClient(); _httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(VersionInfo.ProductName, VersionInfo.ProductVersion)); #pragma warning disable CA1062 _httpClient.Timeout = new TimeSpan(0, 0, config.HttpTimeout); #pragma warning restore CA1062 ITokenClient tokenClient = null; if (!string.IsNullOrEmpty(config.ApiKey)) { tokenClient = new ApiKeyTokenClient(config.ApiKey); } if (!(string.IsNullOrEmpty(config.ClientId) || string.IsNullOrEmpty(config.ClientSecret))) { tokenClient = new OAuthTokenClient(config.DefaultAuthEndpoint, config.AuthEndpoints, config.EnvironmentId, config.ClientId, config.ClientSecret, _httpClient); } s_helper.Check <StorageClientException>(tokenClient == null, Messages.Storage.s_errNullCredentials); _cryptoProvider = config.CryptoProvider; if (config.CryptoProvider == null) { _cryptoProvider = new CryptoProvider(); } _cryptoProvider.ValidateCustomCiphers(config.SecretKeyAccessor?.Invoke()); _hashUtils = new HashUtils(config.EnvironmentId, config.NormalizeKeys, Encoding.UTF8); _transformer = new DtoTransformer(_cryptoProvider, _hashUtils, config.HashSearchKeys, config.SecretKeyAccessor); _dao = HttpDao.NewDao(config.EnvironmentId, tokenClient, _httpClient, config.EndPoint, config.EndpointMask, config.CountriesEndPoint); }
public BreakpointTokenClient(ITokenClient origin) { _origin = origin; Breakpoint = new Breakpoint(); }
public void Init() { _stripe = Substitute.For<IStripeClient>(); _client = new TokenClient(_stripe); }