/// <summary> /// Initializes a new instance of the <see cref="CacheService"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// </exception> public CacheService(IExplorerService service) { service.AssertNotNull(nameof(service)); this.protector = new MachineKeyDataProtector(new[] { typeof(CacheService).FullName }); this.service = service; }
/// <summary> /// Initializes a new instance of the <see cref="GraphClient"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <param name="client">Provides the ability to interact with the Microsoft AD Graph API.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// or /// <paramref name="client"/> is null. /// </exception> public GraphClient(IExplorerService service, IActiveDirectoryClient client) { service.AssertNotNull(nameof(service)); client.AssertNotNull(nameof(client)); this.service = service; this.client = client; }
/// <summary> /// Initializes a new instance of the <see cref="ResourceManager"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <param name="token">A valid JSON Web Token (JWT).</param> /// <exception cref="ArgumentException"> /// <paramref name="token"/> is empty or null. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// </exception> public ResourceManager(IExplorerService service, string token) { service.AssertNotNull(nameof(service)); token.AssertNotEmpty(nameof(token)); this.client = new ResourceManagementClient(new TokenCredentials(token)); this.service = service; }
/// <summary> /// Initializes a new instance of the <see cref="CacheService"/> class. /// </summary> /// <param name="service">Provides access to core services.c</param> /// <param name="connection">Connection to utilized to communicate with the Redis Cache instance.</param> /// <param name="dataProtector">Provides protection for data being cached.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// or /// <paramref name="connection"/> is null. /// or /// <paramref name="dataProtector"/> is null. /// </exception> public CacheService(IExplorerService service, IConnectionMultiplexer connection, IDataProtector dataProtector) { service.AssertNotNull(nameof(service)); connection.AssertNotNull(nameof(connection)); dataProtector.AssertNotNull(nameof(dataProtector)); this.connection = connection; this.protector = dataProtector; this.service = service; }
/// <summary> /// Initializes a new instance of the <see cref="DistributedTokenCache"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <param name="resource">The resource being accessed.</param> /// <param name="key">The unique identifier for the cache entry.</param> /// <exception cref="ArgumentException"> /// <paramref name="resource"/> is empty or null. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// </exception> public DistributedTokenCache(IExplorerService service, string resource, string key = null) { service.AssertNotNull(nameof(service)); resource.AssertNotEmpty(nameof(resource)); this.service = service; this.keyValue = key; this.resource = resource; this.AfterAccess = this.AfterAccessNotification; this.BeforeAccess = this.BeforeAccessNotification; }
public void BeforeEach() { var dependenciesMock = new Mock<IExplorerServiceDependencies>(); _explorerViewModelMock = new Mock<IExplorerViewModel>(); _viewModels = new Collection<IExplorerItemViewModel>(); _explorerViewModelMock.Setup(vm => vm.ExplorerItemViewModels).Returns(_viewModels); dependenciesMock.SetupGet(d => d.ExplorerViewModel).Returns(_explorerViewModelMock.Object); _itemViewModelFactoryMock = new Mock<IExplorerItemViewModelFactory>(); _itemViewModelFactoryMock.Setup( f => f.Create(It.IsAny<IExplorerItem>(), It.IsAny<IEnumerable<IExplorerItemViewModel>>())) .Returns<IExplorerItem, IEnumerable<IExplorerItemViewModel>>((i, c) => new ExplorerItemViewModel(i)); dependenciesMock.SetupGet(d => d.ExplorerItemViewModelFactory).Returns(_itemViewModelFactoryMock.Object); _explorerService = new ExplorerService(dependenciesMock.Object); var level2Nodes1Node1 = new ExplorerItem("EndNode1", () => { }); var level2Nodes1 = new Collection<IExplorerItem> { level2Nodes1Node1 }; var level2Nodes2Node1 = new ExplorerItem("EndNode2", () => { }); var level2Nodes2 = new Collection<IExplorerItem> { level2Nodes2Node1 }; var level1Node1 = new ExplorerItem("Level1Node1", () => { }, level2Nodes1); var level1Node2 = new ExplorerItem("Level1Node2", () => { }, level2Nodes2); var level1Nodes = new Collection<IExplorerItem> { level1Node1, level1Node2 }; _mainNode = new ExplorerItem("MainNode", () => { }, level1Nodes); _explorerService.AddExplorerItem(_mainNode); }
/// <summary> /// Initializes a new instance of the <see cref="GraphClient"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <param name="customerId">Identifier for customer whose resources are being accessed.</param> /// <exception cref="ArgumentException"> /// <paramref name="customerId"/> is empty or null. /// </exception> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// </exception> public GraphClient(IExplorerService service, string customerId) { service.AssertNotNull(nameof(service)); customerId.AssertNotEmpty(nameof(customerId)); this.customerId = customerId; this.service = service; this.client = new ActiveDirectoryClient( new Uri($"{this.service.Configuration.GraphEndpoint}/{customerId}"), async() => { AuthenticationToken token = await this.service.TokenManagement.GetAppOnlyTokenAsync( $"{this.service.Configuration.ActiveDirectoryEndpoint}/{customerId}", this.service.Configuration.GraphEndpoint); return(token.Token); }); }
/// <summary> /// Initializes a new instance of the <see cref="BaseController"/> class. /// </summary> /// <param name="service">Provides access to the core application services.</param> protected BaseController(IExplorerService service) { service.AssertNotNull(nameof(service)); this.service = service; }
/// <summary> /// Configures authentication for the application. /// </summary> /// <param name="app">The application to be configured.</param> public void ConfigureAuth(IAppBuilder app) { IExplorerService service = MvcApplication.UnityContainer.Resolve <IExplorerService>(); app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType); app.UseCookieAuthentication(new CookieAuthenticationOptions()); app.UseOpenIdConnectAuthentication( new OpenIdConnectAuthenticationOptions { ClientId = service.Configuration.ApplicationId, Authority = $"{service.Configuration.ActiveDirectoryEndpoint}/common", Notifications = new OpenIdConnectAuthenticationNotifications { AuthenticationFailed = (context) => { // Track the exceptions using the telemetry provider. service.Telemetry.TrackException(context.Exception); // Pass in the context back to the app context.OwinContext.Response.Redirect("/Home/Error"); // Suppress the exception context.HandleResponse(); return(Task.FromResult(0)); }, AuthorizationCodeReceived = async(context) => { string userTenantId = context.AuthenticationTicket.Identity.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value; string signedInUserObjectId = context.AuthenticationTicket.Identity.FindFirst("http://schemas.microsoft.com/identity/claims/objectidentifier").Value; IGraphClient client = new GraphClient(service, userTenantId); List <RoleModel> roles = await client.GetDirectoryRolesAsync(signedInUserObjectId); foreach (RoleModel role in roles) { context.AuthenticationTicket.Identity.AddClaim(new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Role, role.DisplayName)); } bool isPartnerUser = userTenantId.Equals( service.Configuration.ApplicationTenantId, StringComparison.CurrentCultureIgnoreCase); string customerId = string.Empty; if (!isPartnerUser) { try { Customer c = await service.PartnerOperations.GetCustomerAsync(userTenantId); customerId = c.Id; } catch (PartnerException ex) { if (ex.ErrorCategory != PartnerErrorCategory.NotFound) { throw; } } } if (isPartnerUser || !string.IsNullOrWhiteSpace(customerId)) { // Add the customer identifier to the claims context.AuthenticationTicket.Identity.AddClaim(new System.Security.Claims.Claim("CustomerId", userTenantId)); } }, RedirectToIdentityProvider = (context) => { string appBaseUrl = context.Request.Scheme + "://" + context.Request.Host + context.Request.PathBase; context.ProtocolMessage.RedirectUri = appBaseUrl + "/"; context.ProtocolMessage.PostLogoutRedirectUri = appBaseUrl; return(Task.FromResult(0)); } }, TokenValidationParameters = new TokenValidationParameters { SaveSigninToken = true, ValidateIssuer = false } }); }
/// <summary> /// Initializes a new instance of the <see cref="TokenManagement"/> class. /// </summary> /// <param name="service">Provides access to the application core services.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// </exception> public TokenManagement(IExplorerService service) { service.AssertNotNull(nameof(service)); this.service = service; }
public OutlookMailExplorer(IExplorerService explorerService) { _explorerService = explorerService; }
/// <summary> /// Initializes a new instance of the <see cref="HealthController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public HealthController(IExplorerService service) : base(service) { }
/// <summary> /// Initializes a new instance of the <see cref="ServiceRequestsController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public ServiceRequestsController(IExplorerService service) : base(service) { }
/// <summary> /// Initializes a new instance of the <see cref="Configuration"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="service"/> is null. /// </exception> public Configuration(IExplorerService service) { service.AssertNotNull(nameof(service)); this.service = service; }
/// <summary> /// Initializes a new instance of the <see cref="AuditController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public AuditController(IExplorerService service) : base(service) { }
public TransactionsController() { this.exploreService = new ExplorerService(); }
public ExplorerViewModel(ILog log, IDispatcherSchedulerProvider scheduler, IStandardDialog standardDialog, IExplorerService service, DataSourceSelectorViewModel dataSourceSelectorViewModel, SearchViewModel searchViewModel, DataViewModel dataViewModel, FilterViewModel filterViewModel, PathViewModel pathViewModel, Func<PathItemViewModel> pathItemViewModelFactory) : base(log, scheduler, standardDialog) { _service = service; _pathItemViewModelFactory = pathItemViewModelFactory; Disposables.Add(service); this.SetupHeader(Scheduler, "Explorer"); DataSourceSelectorViewModel = dataSourceSelectorViewModel; this.SyncViewModelActivationStates(DataSourceSelectorViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(DataSourceSelectorViewModel).AddDisposable(Disposables); SearchViewModel = searchViewModel; this.SyncViewModelActivationStates(SearchViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(SearchViewModel).AddDisposable(Disposables); DataViewModel = dataViewModel; this.SyncViewModelActivationStates(DataViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(DataViewModel).AddDisposable(Disposables); FilterViewModel = filterViewModel; this.SyncViewModelActivationStates(FilterViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(FilterViewModel).AddDisposable(Disposables); PathViewModel = pathViewModel; this.SyncViewModelActivationStates(PathViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(PathViewModel).AddDisposable(Disposables); // When the selected DataSource changes, keep the Search upto date. DataSourceSelectorViewModel.DataSources.SelectedItemChanged .Where(x => x != null) .SelectMany(dataSource => SearchViewModel.Reset(dataSource).ToObservable()) .TakeUntil(ClosingStrategy.Closed) .Subscribe(_ => { }); // When the selected Dimension changes, create a new root level path node with the correct query. SearchViewModel.Dimension.SelectedItemChanged .Where(x => x != null) .TakeUntil(ClosingStrategy.Closed) .ObserveOn(Scheduler.Dispatcher.RX) .Subscribe(_ => { var query = new Query { DataSource = DataSourceSelectorViewModel.DataSources.SelectedItem, Entity = SearchViewModel.Entity.SelectedItem, GroupingDimensions = new[] {SearchViewModel.Dimension.SelectedItem}, ParentQuery = null }; var pathItem = _pathItemViewModelFactory(); pathItem.DisplayText = query.GroupingDimensions.First().Name; pathItem.Query = query; PathViewModel.Path.Items.Add(pathItem); PathViewModel.Path.SelectedItem = pathItem; }); // When a DrillDownDimensionRequest is recieved, create a new path node under the currectly selected // node. DataViewModel.DrillDownDimensionRequest .Where(x => x != null) .TakeUntil(ClosingStrategy.Closed) .ObserveOn(Scheduler.Dispatcher.RX) .Subscribe(query => { var pathItem = _pathItemViewModelFactory(); pathItem.DisplayText = query.GroupingDimensions.First().Name; pathItem.Query = query; PathViewModel.Path.SelectedItem.AddChild(pathItem); PathViewModel.Path.SelectedItem = pathItem; }); // As the SelectedPathItem changes, keep the Data upto date. PathViewModel.Path.SelectedItemChanged .Where(x => x != null) .SelectMany(x => GetData(x.Query)) .TakeUntil(ClosingStrategy.Closed) .Subscribe(_ => { }); }
/// <summary> /// Initializes a new instance of the <see cref="HomeController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public HomeController(IExplorerService service) : base(service) { }
public HomeController() { this.exploreService = new ExplorerService(); }
/// <summary> /// Initializes a new instance of the <see cref="OfferController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public OfferController(IExplorerService service) : base(service) { }
public HomeController(IExplorerService explorerService) { _explorerService = explorerService; }
/// <summary> /// Initializes a new instance of the <see cref="ServiceCommunications" /> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <param name="token">Access token to be used for the requests.</param> /// <exception cref="System.ArgumentException"> /// <paramref name="token"/> is null. /// </exception> /// <exception cref="System.ArgumentNullException"> /// <paramref name="service"/> is null. /// </exception> public ServiceCommunications(IExplorerService service, AuthenticationToken token) { service.AssertNotNull(nameof(service)); this.service = service; this.token = token; }
/// <summary> /// Initializes a new instance of the <see cref="PartnerOperations"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> /// <exception cref="ArgumentException"> /// <paramref name="service"/> is null. /// </exception> public PartnerOperations(IExplorerService service) { service.AssertNotNull(nameof(service)); this.service = service; }
public BlocksController() { this.exploreService = new ExplorerService(); }
public ExplorerViewModel(ILog log, IDispatcherSchedulerProvider scheduler, IStandardDialog standardDialog, IExplorerService service, DataSourceSelectorViewModel dataSourceSelectorViewModel, SearchViewModel searchViewModel, DataViewModel dataViewModel, FilterViewModel filterViewModel, PathViewModel pathViewModel, Func <PathItemViewModel> pathItemViewModelFactory) : base(log, scheduler, standardDialog) { _service = service; _pathItemViewModelFactory = pathItemViewModelFactory; Disposables.Add(service); this.SetupHeader(Scheduler, "Explorer"); DataSourceSelectorViewModel = dataSourceSelectorViewModel; this.SyncViewModelActivationStates(DataSourceSelectorViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(DataSourceSelectorViewModel).AddDisposable(Disposables); SearchViewModel = searchViewModel; this.SyncViewModelActivationStates(SearchViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(SearchViewModel).AddDisposable(Disposables); DataViewModel = dataViewModel; this.SyncViewModelActivationStates(DataViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(DataViewModel).AddDisposable(Disposables); FilterViewModel = filterViewModel; this.SyncViewModelActivationStates(FilterViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(FilterViewModel).AddDisposable(Disposables); PathViewModel = pathViewModel; this.SyncViewModelActivationStates(PathViewModel).AddDisposable(Disposables); this.SyncViewModelBusy(PathViewModel).AddDisposable(Disposables); // When the selected DataSource changes, keep the Search upto date. DataSourceSelectorViewModel.DataSources.SelectedItemChanged .Where(x => x != null) .SelectMany(dataSource => SearchViewModel.Reset(dataSource).ToObservable()) .TakeUntil(ClosingStrategy.Closed) .Subscribe(_ => { }); // When the selected Dimension changes, create a new root level path node with the correct query. SearchViewModel.Dimension.SelectedItemChanged .Where(x => x != null) .TakeUntil(ClosingStrategy.Closed) .ObserveOn(Scheduler.Dispatcher.RX) .Subscribe(_ => { var query = new Query { DataSource = DataSourceSelectorViewModel.DataSources.SelectedItem, Entity = SearchViewModel.Entity.SelectedItem, GroupingDimensions = new[] { SearchViewModel.Dimension.SelectedItem }, ParentQuery = null }; var pathItem = _pathItemViewModelFactory(); pathItem.DisplayText = query.GroupingDimensions.First().Name; pathItem.Query = query; PathViewModel.Path.Items.Add(pathItem); PathViewModel.Path.SelectedItem = pathItem; }); // When a DrillDownDimensionRequest is recieved, create a new path node under the currectly selected // node. DataViewModel.DrillDownDimensionRequest .Where(x => x != null) .TakeUntil(ClosingStrategy.Closed) .ObserveOn(Scheduler.Dispatcher.RX) .Subscribe(query => { var pathItem = _pathItemViewModelFactory(); pathItem.DisplayText = query.GroupingDimensions.First().Name; pathItem.Query = query; PathViewModel.Path.SelectedItem.AddChild(pathItem); PathViewModel.Path.SelectedItem = pathItem; }); // As the SelectedPathItem changes, keep the Data upto date. PathViewModel.Path.SelectedItemChanged .Where(x => x != null) .SelectMany(x => GetData(x.Query)) .TakeUntil(ClosingStrategy.Closed) .Subscribe(_ => { }); }
/// <summary> /// Initializes a new instance of the <see cref="Communication"/> class. /// </summary> /// <param name="service">Provides access to the core services.</param> public Communication(IExplorerService service) { }
/// <summary> /// Initializes a new instance of the <see cref="SubscriptionsController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public SubscriptionsController(IExplorerService service) : base(service) { }
/// <summary> /// Initializes a new instance of the <see cref="UsersController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public UsersController(IExplorerService service) : base(service) { }
/// <summary> /// Initialized a new instance of <see cref="FileExplorerController"/> class /// </summary> /// <param name="explorerService">Explorer service</param> public FileExplorerController(IExplorerService explorerService) { _explorerService = explorerService; }
public ExplorerViewModel(IExplorerService explorerService) { this.explorerService = explorerService; this.Current = explorerService.GetHomeDirectory(); }
/// <summary> /// Initializes a new instance of the <see cref="DomainsController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public DomainsController(IExplorerService service) : base(service) { }
/// <summary> /// Initializes a new instance of the <see cref="ManageController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public ManageController(IExplorerService service) : base(service) { }
/// <summary> /// Initializes a new instance of the <see cref="InvoicesController"/> class. /// </summary> /// <param name="service">Provides access to core services.</param> public InvoicesController(IExplorerService service) : base(service) { }