public ConnectionViewModel(IUserDialogs userDialogs, INavigationService navigationService, ICustomAgentContextProvider agentContextProvider, IMessageService messageService, IDiscoveryService discoveryService, IConnectionService connectionService, IEventAggregator eventAggregator, ConnectionRecord record) : base(nameof(ConnectionViewModel), userDialogs, navigationService) { _agentContextProvider = agentContextProvider; _messageService = messageService; _discoveryService = discoveryService; _connectionService = connectionService; _eventAggregator = eventAggregator; _record = record; MyDid = _record.MyDid; TheirDid = _record.TheirDid; ConnectionName = _record.Alias.Name; ConnectionSubtitle = $"{_record.State:G}"; ConnectionImageUrl = _record.Alias.ImageUrl; }
public ConnectionViewModel(IUserDialogs userDialogs, INavigationService navigationService, IAgentProvider agentContextProvider, IMessageService messageService, IDiscoveryService discoveryService, IConnectionService connectionService, IEventAggregator eventAggregator, IWalletRecordService walletRecordService, ILifetimeScope scope, ConnectionRecord record) : base(nameof(ConnectionViewModel), userDialogs, navigationService) { _agentContextProvider = agentContextProvider; _messageService = messageService; _discoveryService = discoveryService; _connectionService = connectionService; _eventAggregator = eventAggregator; _walletRecordSevice = walletRecordService; _scope = scope; _record = record; MyDid = _record.MyDid; TheirDid = _record.TheirDid; ConnectionName = _record.Alias?.Name ?? _record.Id; ConnectionSubtitle = $"{_record.State:G}"; ConnectionImageUrl = _record.Alias?.ImageUrl; ConnectionImageSource = Base64StringToImageSource.Base64StringToImage(_record.Alias?.ImageUrl); Messages = new ObservableCollection <RecordBase>(); }
internal static async Task <MobileConnectStatus> AttemptDiscovery(IDiscoveryService discovery, string msisdn, string mcc, string mnc, IEnumerable <BasicKeyValuePair> cookies, MobileConnectConfig config, MobileConnectRequestOptions options) { DiscoveryResponse response = null; try { DiscoveryOptions discoveryOptions = options?.DiscoveryOptions ?? new DiscoveryOptions(); discoveryOptions.MSISDN = msisdn; discoveryOptions.IdentifiedMCC = mcc; discoveryOptions.IdentifiedMNC = mnc; discoveryOptions.RedirectUrl = config.RedirectUrl; discoveryOptions.XRedirect = config.XRedirect; response = await discovery.StartAutomatedOperatorDiscoveryAsync(config, config.RedirectUrl, discoveryOptions, cookies); } catch (MobileConnectInvalidArgumentException e) { Log.Error(() => $"An invalid argument was passed to AttemptDiscovery arg={e.Argument}"); return(MobileConnectStatus.Error(ErrorCodes.InvalidArgument, string.Format("An argument was found to be invalid during the process. The argument was {0}.", e.Argument), e)); } catch (MobileConnectEndpointHttpException e) { Log.Error(() => $"A general http error occurred in AttemptDiscovery msisdn={!string.IsNullOrEmpty(msisdn)} mcc={mcc} mnc={mnc} discoveryUrl={config.DiscoveryUrl}"); return(MobileConnectStatus.Error(ErrorCodes.HttpFailure, "An HTTP failure occured while calling the discovery endpoint, the endpoint may be inaccessible", e)); } catch (Exception e) { Log.Error(() => $"A general error occurred in AttemptDiscovery msisdn={!string.IsNullOrEmpty(msisdn)} mcc={mcc} mnc={mnc} discoveryUrl={config.DiscoveryUrl}"); return(MobileConnectStatus.Error(ErrorCodes.Unknown, "An unknown error occured while calling the Discovery service to obtain operator details", e)); } return(GenerateStatusFromDiscoveryResponse(discovery, response)); }
public IItemEnumerable <IQueryResult> Query(string statement, bool searchAllVersions, IOperationContext context) { IDiscoveryService service = Binding.GetDiscoveryService(); IOperationContext ctxt = new OperationContext(context); PageFetcher <IQueryResult> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // fetch the data IObjectList resultList = service.Query(RepositoryId, statement, searchAllVersions, ctxt.IncludeAllowableActions, ctxt.IncludeRelationships, ctxt.RenditionFilterString, maxNumItems, skipCount, null); // convert query results IList <IQueryResult> page = new List <IQueryResult>(); if (resultList.Objects != null) { foreach (IObjectData objectData in resultList.Objects) { if (objectData == null) { continue; } page.Add(ObjectFactory.ConvertQueryResult(objectData)); } } return(new PageFetcher <IQueryResult> .Page <IQueryResult>(page, resultList.NumItems, resultList.HasMoreItems)); }; return(new CollectionEnumerable <IQueryResult>(new PageFetcher <IQueryResult>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
private static Uri GetModelServiceUri(string uri) { if (string.IsNullOrEmpty(uri)) { IDiscoveryService discoveryService = DiscoveryServiceProvider.Instance.ServiceClient; ContentServiceCapability contentService = discoveryService.CreateQuery <ContentServiceCapability>().Take(1).FirstOrDefault(); if (contentService == null) { throw new ModelServiceException("Content Service Capability not found in Discovery Service."); } ContentKeyValuePair modelServiceExtensionProperty = contentService.ExtensionProperties .FirstOrDefault( xp => xp.Key.Equals(ModelServiceExtensionPropertyName, StringComparison.OrdinalIgnoreCase)); if (modelServiceExtensionProperty == null) { throw new ModelServiceException( $"{ModelServiceName} is not registered; no extension property called '{ModelServiceExtensionPropertyName}' found on Content Service Capability."); } uri = modelServiceExtensionProperty.Value ?? string.Empty; } uri = uri.TrimEnd('/') + '/'; Uri baseUri; if (!Uri.TryCreate(uri, UriKind.Absolute, out baseUri)) { throw new ModelServiceException($"{ModelServiceName} is using an invalid uri '{uri}'."); } Logger.Debug($"{ModelServiceName} found at URL '{baseUri}'."); return(baseUri); }
public static OrganizationDetail GetOrganization(this IDiscoveryService service, Guid organizationId) { var details = GetAllOrganizations(service); var result = details.FirstOrDefault(d => d.OrganizationId == organizationId); return(result); }
/// <summary>Discovers the organizations that the calling user belongs to.</summary> /// <param name="service">A Discovery service proxy instance.</param> /// <returns>Array containing detailed information on each organization that /// the user belongs to.</returns> public static OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) { var orgRequest = new RetrieveOrganizationsRequest(); var orgResponse = (RetrieveOrganizationsResponse)service.Execute(orgRequest); return(orgResponse.Details); }
/// <summary> /// Discovers the organizations that the calling user belongs to. /// </summary> /// <param name="service">A Discovery service proxy instance.</param> /// <returns>Array containing detailed information on each organization that the user belongs to.</returns> public static OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) { if (service == null) { throw new AdapterException(string.Format(CultureInfo.CurrentCulture, Resources.ParamterNullExceptionMessage), new ArgumentNullException("service")) { ExceptionId = AdapterException.SystemExceptionGuid }; } RetrieveOrganizationsResponse orgResponse = null; try { orgResponse = (RetrieveOrganizationsResponse)service.Execute(new RetrieveOrganizationsRequest()); } catch (SecurityNegotiationException ex) { throw new AdapterException(string.Format(CultureInfo.CurrentCulture, ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex) { ExceptionId = AdapterException.SystemExceptionGuid }; } return(orgResponse != null ? orgResponse.Details : null); }
public ConnectionViewModel(IUserDialogs userDialogs, INavigationService navigationService, IAgentProvider agentProvider, IMessageService messageService, IDiscoveryService discoveryService, IConnectionService connectionService, IEventAggregator eventAggregator, ConnectionRecord record) : base(nameof(ConnectionsViewModel), userDialogs, navigationService) { _agentProvider = agentProvider; _messageService = messageService; _discoveryService = discoveryService; _connectionService = connectionService; _eventAggregator = eventAggregator; _record = record; someMaterialColor = new Helpers.SomeMaterialColor(); MyDid = _record.MyDid; TheirDid = _record.TheirDid; ConnectionName = _record.Alias.Name; ConnectionSubtitle = $"{_record.State:G}"; Title = "Connection Detail"; if (this._connectionImageUrl == null) { _connectionImageUrl = $"https://ui-avatars.com/api/?name={_connectionName}&length=1&background={_organizeColor}&color=fff&size=128"; } else { _connectionImageUrl = _record.Alias.ImageUrl; } if (_record.CreatedAtUtc != null) { _createdDate = (DateTime)_record.CreatedAtUtc; } }
public RestClient(IHostingEnvironment env, IDiscoveryService discoveryService, HttpClient client = null) { _env = env; _client = client ?? new HttpClient(); _discoveryService = discoveryService; _logger = LoggerHelper.GetLogger <RestClient>(); }
/// <summary> /// получение всех организаций /// </summary> /// <param name="service"></param> /// <returns></returns> private static OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) { RetrieveOrganizationsRequest request = new RetrieveOrganizationsRequest(); RetrieveOrganizationsResponse response = (RetrieveOrganizationsResponse)service.Execute(request); return(response.Details); }
public PipelineDebugController() { CorePipelineService = ServiceLocator.ServiceProvider.GetRequiredService <IPipelineService>(); DiscoveryService = ServiceLocator.ServiceProvider.GetRequiredService <IDiscoveryService>(); SettingsService = ServiceLocator.ServiceProvider.GetRequiredService <ISettingsService>(); OutputService = ServiceLocator.ServiceProvider.GetRequiredService <IOutputService>(); }
/// <summary> /// 构造 /// </summary> /// <param name="discoveryService"></param> /// <param name="storageFileService"></param> /// <param name="currencyService"></param> /// <param name="userContainer"></param> public AdminController(IDiscoveryService discoveryService, IStorageFileService storageFileService, ICurrencyService currencyService, IUserContainer userContainer) { _discoveryService = discoveryService; _storageFileService = storageFileService; _currencyService = currencyService; _userContainer = userContainer; }
public SendDumpService(IXWebRepo <DumpPostResult> dumpLocalNetworkRepo, IDiscoveryService discoveryService, IXWebRepo <DumpPostResult> localNetworkRepo) { _dumpLocalNetworkRepo = dumpLocalNetworkRepo; _discoveryService = discoveryService; _localNetworkRepo = localNetworkRepo; }
private IEnumerable <RouteMetadata> GetRoutes(IDiscoveryService discovery, Type type) { foreach (RouteMetadata route in discovery.GetRoutes(type)) { route.Factory = route.Factory ?? (() => this.ServiceProvider.GetService(type)); yield return(route); } }
/// <summary> /// Initializes a new instance of the MobileConnectInterface class /// </summary> /// <param name="config">Configuration options</param> /// <param name="discovery">Instance of IDiscovery concrete implementation</param> /// <param name="authentication">Instance of IAuthentication concrete implementation</param> /// <param name="identity">Instance of IIdentityService concrete implementation</param> /// <param name="jwks">Instance of IJWKeysetService concrete implementation</param> public MobileConnectInterface(MobileConnectConfig config, IDiscoveryService discovery, IAuthenticationService authentication, IIdentityService identity, IJWKeysetService jwks) { this._discovery = discovery; this._authentication = authentication; this._identity = identity; this._jwks = jwks; this._config = config; }
/// <summary> /// Discovers the organizations that the calling user belongs to. /// </summary> /// <param name="service">A Discovery service proxy instance.</param> /// <returns> /// Array containing detailed information on each organization that /// the user belongs to. /// </returns> public OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) { if (service == null) throw new ArgumentNullException("service"); var orgRequest = new RetrieveOrganizationsRequest(); var orgResponse = (RetrieveOrganizationsResponse)service.Execute(orgRequest); return orgResponse.Details; }
public RootMasterDetailViewModel(IViewResolver viewResolver, IWebService webService, ILocalDumpService localDumps, IDiscoveryService discoveryService) : base(viewResolver) { _webService = webService; _localDumps = localDumps; _discoveryService = discoveryService; }
public OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) { if (service == null) throw new ArgumentNullException("service"); RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest(); RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)service.Execute(orgRequest); return orgResponse.Details; }
public static OrganizationDetail[] GetAllOrganizations(this IDiscoveryService service) { var request = new RetrieveOrganizationsRequest(); var response = (RetrieveOrganizationsResponse)service.Execute(request); var details = response.Details.ToArray(); return(details); }
public InitializingSplashWindowViewModel(IDiscoveryService discoveryService, IVisualComponentsFactory viewFactory, ConnectionService connectionService, UcsAutoReconnectService reconnectionService) { _connectionService = connectionService ?? throw new ArgumentNullException(nameof(connectionService)); _viewFactory = viewFactory ?? throw new ArgumentNullException(nameof(viewFactory)); _discoveryService = discoveryService ?? throw new ArgumentNullException(nameof(discoveryService)); _reconnectionService = reconnectionService ?? throw new ArgumentNullException(nameof(reconnectionService)); }
/// <summary> /// Initializes the container and routes. /// </summary> protected void Initialize() { IDiscoveryService discovery = this.GetDiscoveryService(); IReadOnlyCollection <Type> types = this.RegisterTypes(discovery); List <RouteMetadata> routes = types.SelectMany(t => this.GetRoutes(discovery, t)).ToList(); this.RegisterInstance(typeof(IRouteMapper), new RouteMapper(routes)); }
private void Setup(ICache cache) { _restClient = new MockRestClient(); _cache = cache; _discovery = new MobileConnect.Discovery.DiscoveryService(cache, this._restClient); _config = new MobileConnectConfig() { ClientId = "1234567890", ClientSecret = "1234567890", DiscoveryUrl = "http://localhost:8080/v2/discovery/" }; }
public MobileConnectInterface(IDiscoveryService discovery, IAuthenticationService authentication, MobileConnectConfig config) { var client = new RestClient(); _discovery = discovery; _authentication = authentication; _identity = new IdentityService(client); _jwks = new JWKeysetService(client, new DiscoveryCache()); _config = config; }
public InitalizeCommand(IDiscoveryService discoveryService, IFileSystem fileSystem, IProjectManager projectManager, IConfigurationService configurationService, IConsole console) : base(projectManager, configurationService, console) { _discoveryService = discoveryService; _fileSystem = fileSystem; }
public MobileConnectInterface(IDiscoveryService discovery, IAuthenticationService authentication, MobileConnectConfig config) { var cache = discovery.Cache; var client = new Utils.RestClient(); this._discovery = discovery; this._authentication = authentication; this._identity = new IdentityService(client); this._jwks = new JWKeysetService(client, cache); this._config = config; }
public void GetDiscoveryServiceShouldGetTheServiceFromTheServiceProvider() { IDiscoveryService discoveryService = Substitute.For <IDiscoveryService>(); this.bootstrapper.Provider.GetService(typeof(IDiscoveryService)) .Returns(discoveryService); IDiscoveryService result = this.bootstrapper.OriginalGetDiscoveryService(); Assert.That(result, Is.SameAs(discoveryService)); }
protected override async Task <Task> StartProcessAsync(CancellationToken stopCancellationToken) { _log.Debug("Connecting"); _connection = await ClientConnectionFactory.Instance.ConnectAsync(_options, stopCancellationToken).ConfigureAwait(false); ConnectionId = _connection.Id; _log = LogManager.GetLogger <Client>(_connection.Id.ToString()); _outcomingInvocationFactory = new OutcomingInvocationFactory(_connection, _options.Protocol, _options.Marshaller); _discoveryService = new DiscoveryService(ConnectionId, _connection, _options.Protocol); return(ProcessAsync(stopCancellationToken)); }
private OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) { if (service == null) { throw new ArgumentNullException("service"); } RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest(); RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)service.Execute(orgRequest); return(orgResponse.Details); }
public PublicationsController( IPublicationService publicationService, IDiscoveryService discoveryService, IJournalService journalService, UserManager <User> userManager) { this.publicationService = publicationService; this.discoveryService = discoveryService; this.journalService = journalService; this.userManager = userManager; }
/// <summary> /// Initializes a new instance of the MobileConnectWebInterface class /// </summary> /// <param name="discovery">Instance of IDiscovery concrete implementation</param> /// <param name="authentication">Instance of IAuthentication concrete implementation</param> /// <param name="identity">Instance of IIdentityService concrete implementation</param> /// <param name="jwks">Instance of IJWKeysetService concrete implementation</param> /// <param name="config">Configuration options</param> public MobileConnectWebInterface(IDiscoveryService discovery, IAuthenticationService authentication, IIdentityService identity, IJWKeysetService jwks, MobileConnectConfig config) { this._discovery = discovery; this._authentication = authentication; this._identity = identity; this._jwks = jwks; this._config = config; this._cacheWithSessionId = config.CacheResponsesWithSessionId && discovery.Cache != null; Log.Debug(() => _cacheWithSessionId ? $"MobileConnectWebInterface caching enabled with type={discovery.Cache.GetType().AssemblyQualifiedName}" : "MobileConnectWebInterface caching disabled"); }
/// <summary> /// Discovers the organizations that the calling user belongs to. /// </summary> /// <param name="service">A Discovery service proxy instance.</param> /// <returns>Array containing detailed information on each organization that the user belongs to.</returns> public static OrganizationDetailCollection DiscoverOrganizations(IDiscoveryService service) { if (service == null) { throw new AdapterException(string.Format(CultureInfo.CurrentCulture, Resources.ParamterNullExceptionMessage), new ArgumentNullException("service")) { ExceptionId = AdapterException.SystemExceptionGuid }; } RetrieveOrganizationsResponse orgResponse = null; try { orgResponse = (RetrieveOrganizationsResponse)service.Execute(new RetrieveOrganizationsRequest()); } catch (SecurityNegotiationException ex) { throw new AdapterException(string.Format(CultureInfo.CurrentCulture, ex.InnerException != null ? ex.InnerException.Message : ex.Message), ex) { ExceptionId = AdapterException.SystemExceptionGuid }; } return orgResponse != null ? orgResponse.Details : null; }