protected SecurityControllerBase(ISecurityServiceBase <TEntity> service) { Service = service; UserManager = HttpContext.Current?.GetOwinContext()?.GetUserManager <UserManager>(); AppSession = new AppSession(); var tenantId = HttpContext.Current?.Request.Headers["TenantId"]; UserManager?.SetTenantId(string.IsNullOrWhiteSpace(tenantId) ? null : tenantId); }
protected sealed override async void OnInitialized() { try { IEnumerable <ITelemetryService> allTelemetryServices = Container.Resolve <IEnumerable <ITelemetryService> >(); ISecurityServiceBase securityService = Container.Resolve <ISecurityServiceBase>(); IMessageReceiver?messageReceiver = Container.Resolve <ILifetimeScope>().ResolveOptional <IMessageReceiver>(); IDeviceService deviceService = Container.Resolve <IDeviceService>(); bool isLoggedIn = await securityService.IsLoggedInAsync().ConfigureAwait(false); string?userId = !isLoggedIn ? null : await securityService.GetUserIdAsync(default).ConfigureAwait(false);