Esempio n. 1
0
        public static void SeedDatabase(this IApplicationBuilder applicationBuilder, ICipherService cipherService)
        {
            _cipherService = cipherService;

            using (var serviceScope = applicationBuilder.ApplicationServices
                                      .GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                try
                {
                    var context       = serviceScope.ServiceProvider.GetService <IMongoClient>();
                    var databse       = context.GetDatabase("chatrdb");
                    var users         = databse.GetCollection <User>("users");
                    var conversations = databse.GetCollection <Conversation>("conversations");
                    var messages      = databse.GetCollection <Message>("messages");

                    if (!users.Aggregate().Any())
                    {
                        Users().ForEach(user => users.InsertOne(user));
                    }

                    var userList = users.Aggregate().ToList();

                    if (!conversations.Aggregate().Any())
                    {
                        Conversations(userList[0].Id.ToString(), userList[1].Id.ToString()).ForEach(conversation => conversations.InsertOne(conversation));
                    }
                }
                catch (Exception ex)
                {
                    var services = serviceScope.ServiceProvider;
                    var logger   = services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "An error occurred seeding the DB.");
                }
            }
        }
Esempio n. 2
0
        public VaultAutofillListCiphersPage(AppOptions appOptions)
            : base(true)
        {
            _appOptions = appOptions;
            Uri         = appOptions.Uri;
            if (Uri.StartsWith(Constants.AndroidAppProtocol))
            {
                _name = Uri.Substring(Constants.AndroidAppProtocol.Length);
            }
            else if (!System.Uri.TryCreate(Uri, UriKind.Absolute, out Uri uri) ||
                     !DomainName.TryParseBaseDomain(uri.Host, out _name))
            {
                _name = "--";
            }

            _cipherService         = Resolver.Resolve <ICipherService>();
            _deviceInfoService     = Resolver.Resolve <IDeviceInfoService>();
            DeviceActionService    = Resolver.Resolve <IDeviceActionService>();
            _settingsService       = Resolver.Resolve <ISettingsService>();
            _appSettingsService    = Resolver.Resolve <IAppSettingsService>();
            GoogleAnalyticsService = Resolver.Resolve <IGoogleAnalyticsService>();
            _connectivity          = Resolver.Resolve <IConnectivity>();

            Init();
        }
 public EmergencyAccessService(
     IEmergencyAccessRepository emergencyAccessRepository,
     IOrganizationUserRepository organizationUserRepository,
     IUserRepository userRepository,
     ICipherRepository cipherRepository,
     IPolicyRepository policyRepository,
     ICipherService cipherService,
     IMailService mailService,
     IUserService userService,
     IPasswordHasher <User> passwordHasher,
     IDataProtectionProvider dataProtectionProvider,
     GlobalSettings globalSettings,
     IOrganizationService organizationService)
 {
     _emergencyAccessRepository  = emergencyAccessRepository;
     _organizationUserRepository = organizationUserRepository;
     _userRepository             = userRepository;
     _cipherRepository           = cipherRepository;
     _policyRepository           = policyRepository;
     _cipherService       = cipherService;
     _mailService         = mailService;
     _userService         = userService;
     _passwordHasher      = passwordHasher;
     _dataProtector       = dataProtectionProvider.CreateProtector("EmergencyAccessServiceDataProtector");
     _globalSettings      = globalSettings;
     _organizationService = organizationService;
 }
Esempio n. 4
0
        public SyncService(
            IUserService userService,
            IApiService apiService,
            ISettingsService settingsService,
            IFolderService folderService,
            ICipherService cipherService,
            ICryptoService cryptoService,
            ICollectionService collectionService,
            IStorageService storageService,
            IMessagingService messagingService,
            ICozyClientService cozyClientService,
            Func <bool, Task> logoutCallbackAsync)
        {
            _userService       = userService;
            _apiService        = apiService;
            _settingsService   = settingsService;
            _folderService     = folderService;
            _cipherService     = cipherService;
            _cryptoService     = cryptoService;
            _collectionService = collectionService;
            _storageService    = storageService;
            _messagingService  = messagingService;

            #region cozy
            _cozyClientService = cozyClientService;
            #endregion

            _logoutCallbackAsync = logoutCallbackAsync;
        }
Esempio n. 5
0
        public GroupingsPageViewModel()
        {
            _cipherService           = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService           = ServiceContainer.Resolve <IFolderService>("folderService");
            _collectionService       = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _syncService             = ServiceContainer.Resolve <ISyncService>("syncService");
            _vaultTimeoutService     = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _deviceActionService     = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _platformUtilsService    = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _messagingService        = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService            = ServiceContainer.Resolve <IStateService>("stateService");
            _passwordRepromptService = ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService");
            _organizationService     = ServiceContainer.Resolve <IOrganizationService>("organizationService");
            _policyService           = ServiceContainer.Resolve <IPolicyService>("policyService");
            _logger = ServiceContainer.Resolve <ILogger>("logger");

            Loading        = true;
            GroupedItems   = new ObservableRangeCollection <IGroupingsPageListItem>();
            RefreshCommand = new Command(async() =>
            {
                Refreshing = true;
                await LoadAsync();
            });
            CipherOptionsCommand = new Command <CipherView>(CipherOptionsAsync);

            AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger)
            {
                AllowAddAccountRow = true
            };
        }
Esempio n. 6
0
        public ViewPageViewModel()
        {
            _deviceActionService     = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _cipherService           = ServiceContainer.Resolve <ICipherService>("cipherService");
            _userService             = ServiceContainer.Resolve <IUserService>("userService");
            _totpService             = ServiceContainer.Resolve <ITotpService>("totpService");
            _platformUtilsService    = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _auditService            = ServiceContainer.Resolve <IAuditService>("auditService");
            _messagingService        = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _eventService            = ServiceContainer.Resolve <IEventService>("eventService");
            _passwordRepromptService = ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService");
            _localizeService         = ServiceContainer.Resolve <ILocalizeService>("localizeService");
            _clipboardService        = ServiceContainer.Resolve <IClipboardService>("clipboardService");

            CopyCommand               = new Command <string>((id) => CopyAsync(id, null));
            CopyUriCommand            = new Command <LoginUriView>(CopyUri);
            CopyFieldCommand          = new Command <FieldView>(CopyField);
            LaunchUriCommand          = new Command <LoginUriView>(LaunchUri);
            TogglePasswordCommand     = new Command(TogglePassword);
            ToggleCardNumberCommand   = new Command(ToggleCardNumber);
            ToggleCardCodeCommand     = new Command(ToggleCardCode);
            CheckPasswordCommand      = new Command(CheckPasswordAsync);
            DownloadAttachmentCommand = new Command <AttachmentView>(DownloadAttachmentAsync);

            PageTitle = AppResources.ViewItem;
        }
 public CookieUtility(int defaultExpirationDays, string appKey, string appSalt, ICipherService cipherService)
 {
     _defaultExpirationDays = defaultExpirationDays;
     _appKey        = appKey;
     _appSalt       = appSalt;
     _cipherService = cipherService;
 }
Esempio n. 8
0
        public GroupingsPageViewModel()
        {
            _cipherService           = ServiceContainer.Resolve <ICipherService>("cipherService");
            _folderService           = ServiceContainer.Resolve <IFolderService>("folderService");
            _collectionService       = ServiceContainer.Resolve <ICollectionService>("collectionService");
            _syncService             = ServiceContainer.Resolve <ISyncService>("syncService");
            _userService             = ServiceContainer.Resolve <IUserService>("userService");
            _vaultTimeoutService     = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _deviceActionService     = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _platformUtilsService    = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _messagingService        = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _stateService            = ServiceContainer.Resolve <IStateService>("stateService");
            _storageService          = ServiceContainer.Resolve <IStorageService>("storageService");
            _passwordRepromptService = ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService");

            Loading        = true;
            PageTitle      = AppResources.MyVault;
            GroupedItems   = new ExtendedObservableCollection <GroupingsPageListGroup>();
            RefreshCommand = new Command(async() =>
            {
                Refreshing = true;
                await LoadAsync();
            });
            CipherOptionsCommand = new Command <CipherView>(CipherOptionsAsync);
        }
Esempio n. 9
0
 public SyncService(
     IStateService stateService,
     IApiService apiService,
     ISettingsService settingsService,
     IFolderService folderService,
     ICipherService cipherService,
     ICryptoService cryptoService,
     ICollectionService collectionService,
     IOrganizationService organizationService,
     IMessagingService messagingService,
     IPolicyService policyService,
     ISendService sendService,
     IKeyConnectorService keyConnectorService,
     Func <Tuple <string, bool, bool>, Task> logoutCallbackAsync)
 {
     _stateService        = stateService;
     _apiService          = apiService;
     _settingsService     = settingsService;
     _folderService       = folderService;
     _cipherService       = cipherService;
     _cryptoService       = cryptoService;
     _collectionService   = collectionService;
     _organizationService = organizationService;
     _messagingService    = messagingService;
     _policyService       = policyService;
     _sendService         = sendService;
     _keyConnectorService = keyConnectorService;
     _logoutCallbackAsync = logoutCallbackAsync;
 }
 public LoginsService(Context ffsaDbContext, ICipherService cipherService, IEmailsService emailsService, ILoginsValidation loginsValidation)
 {
     _ffsaDbContext    = ffsaDbContext;
     _cipherService    = cipherService;
     _emailsService    = emailsService;
     _loginsValidation = loginsValidation;
 }
Esempio n. 11
0
 public CipherServiceTests()
 {
     _key             = "Super Secret Key";
     _normalString    = "Normal";
     _encryptedString = "BH10ICbw6c3x32o0/AoSBQ==";
     _cipher          = new CipherService();
 }
Esempio n. 12
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ICipherService cipherService, ILogger <Startup> logger)
        {
            app.SeedDatabase(cipherService);

            app.UseAuthentication();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseHttpsRedirection();
            app.UseHsts();
            app.UseCors("CorsPolicy");

            app.UseSignalR(routes =>
            {
                routes.MapHub <ChatHub> ("/chat");
            });

            app.UseSwagger();
            app.UseSwaggerUI(s => {
                s.SwaggerEndpoint("/swagger/v1/swagger.json", "API V1");
                s.RoutePrefix = "api/docs";
            });

            app.UseMvc();
        }
Esempio n. 13
0
 public QRCodeGeneration(ICloudStorage cloudStorage, IConfiguration configuration, ICipherService cipher, IEnvironmentService env)
 {
     _cipher        = cipher;
     _configuration = configuration;
     _cloudStorage  = cloudStorage;
     _env           = env;
 }
Esempio n. 14
0
 public ExportService(
     IFolderService folderService,
     ICipherService cipherService)
 {
     _folderService = folderService;
     _cipherService = cipherService;
 }
Esempio n. 15
0
 public SyncService(
     ICipherApiRepository cipherApiRepository,
     IFolderApiRepository folderApiRepository,
     IAccountsApiRepository accountsApiRepository,
     ISettingsApiRepository settingsApiRepository,
     ISyncApiRepository syncApiRepository,
     IFolderRepository folderRepository,
     ICollectionRepository collectionRepository,
     ICipherCollectionRepository cipherCollectionRepository,
     ICipherService cipherService,
     IAttachmentRepository attachmentRepository,
     ISettingsRepository settingsRepository,
     IAuthService authService,
     ICryptoService cryptoService,
     ISettings settings,
     IAppSettingsService appSettingsService)
 {
     _cipherApiRepository        = cipherApiRepository;
     _folderApiRepository        = folderApiRepository;
     _accountsApiRepository      = accountsApiRepository;
     _settingsApiRepository      = settingsApiRepository;
     _syncApiRepository          = syncApiRepository;
     _folderRepository           = folderRepository;
     _collectionRepository       = collectionRepository;
     _cipherCollectionRepository = cipherCollectionRepository;
     _cipherService        = cipherService;
     _attachmentRepository = attachmentRepository;
     _settingsRepository   = settingsRepository;
     _authService          = authService;
     _cryptoService        = cryptoService;
     _settings             = settings;
     _appSettingsService   = appSettingsService;
 }
Esempio n. 16
0
 public VaultTimeoutService(
     ICryptoService cryptoService,
     IStateService stateService,
     IPlatformUtilsService platformUtilsService,
     IFolderService folderService,
     ICipherService cipherService,
     ICollectionService collectionService,
     ISearchService searchService,
     IMessagingService messagingService,
     ITokenService tokenService,
     IPolicyService policyService,
     IKeyConnectorService keyConnectorService,
     Func <Tuple <string, bool>, Task> lockedCallback,
     Func <Tuple <string, bool, bool>, Task> loggedOutCallback)
 {
     _cryptoService        = cryptoService;
     _stateService         = stateService;
     _platformUtilsService = platformUtilsService;
     _folderService        = folderService;
     _cipherService        = cipherService;
     _collectionService    = collectionService;
     _searchService        = searchService;
     _messagingService     = messagingService;
     _tokenService         = tokenService;
     _policyService        = policyService;
     _keyConnectorService  = keyConnectorService;
     _lockedCallback       = lockedCallback;
     _loggedOutCallback    = loggedOutCallback;
 }
Esempio n. 17
0
 public SearchService(
     ICipherService cipherService,
     ISendService sendService)
 {
     _cipherService = cipherService;
     _sendService   = sendService;
 }
Esempio n. 18
0
        public ContestantsController(
            IHttpContextAccessor httpContext,
            UserManager <User> userManager,
            IBaseService baseService,
            ICipherService chipherService,
            INotificationService notifyService,
            IContestantsService contestantsService,
            ICategoriesService categoriesService,
            ISkillsService skillsService,
            ILocationService locationService,
            ILanguageService langService,
            IFavoritesService favoriteService)
        {
            _httpcontext    = httpContext;
            _userManager    = userManager;
            _baseService    = baseService;
            _chipherService = chipherService;

            _notifyService      = notifyService;
            _contestantsService = contestantsService;
            _categoriesService  = categoriesService;

            _skillsService   = skillsService;
            _locationService = locationService;
            _langService     = langService;
            _favoriteService = favoriteService;
        }
Esempio n. 19
0
 public EmailsService(IOptions <EnvironmentConfig> environmentConfig, ICipherService cipherService, IEmailHelper emailhelper, IEmailsValidation emailsValidation)
 {
     _environmentConfig = environmentConfig.Value;
     _cipherService     = cipherService;
     _emailhelper       = emailhelper;
     _emailsValidation  = emailsValidation;
 }
Esempio n. 20
0
 public EmergencyAccessService(
     IEmergencyAccessRepository emergencyAccessRepository,
     IOrganizationUserRepository organizationUserRepository,
     IUserRepository userRepository,
     ICipherRepository cipherRepository,
     IPolicyRepository policyRepository,
     ICipherService cipherService,
     IMailService mailService,
     IUserService userService,
     IPasswordHasher <User> passwordHasher,
     GlobalSettings globalSettings,
     IOrganizationService organizationService,
     IDataProtectorTokenFactory <EmergencyAccessInviteTokenable> dataProtectorTokenizer)
 {
     _emergencyAccessRepository  = emergencyAccessRepository;
     _organizationUserRepository = organizationUserRepository;
     _userRepository             = userRepository;
     _cipherRepository           = cipherRepository;
     _policyRepository           = policyRepository;
     _cipherService          = cipherService;
     _mailService            = mailService;
     _userService            = userService;
     _passwordHasher         = passwordHasher;
     _globalSettings         = globalSettings;
     _organizationService    = organizationService;
     _dataProtectorTokenizer = dataProtectorTokenizer;
 }
 public UserService(IPeopleService peopleService, ISMSDbContextGenericRepository <User> userRepo, ICipherService cipherService, IMapper mapper)
 {
     _peopleService = peopleService;
     _userRepo      = userRepo;
     _cipherService = cipherService;
     _mapper        = mapper;
 }
Esempio n. 22
0
 public VaultTimeoutService(
     ICryptoService cryptoService,
     IUserService userService,
     IPlatformUtilsService platformUtilsService,
     IStorageService storageService,
     IFolderService folderService,
     ICipherService cipherService,
     ICollectionService collectionService,
     ISearchService searchService,
     IMessagingService messagingService,
     ITokenService tokenService,
     Action <bool> lockedCallback,
     Func <bool, Task> loggedOutCallback)
 {
     _cryptoService        = cryptoService;
     _userService          = userService;
     _platformUtilsService = platformUtilsService;
     _storageService       = storageService;
     _folderService        = folderService;
     _cipherService        = cipherService;
     _collectionService    = collectionService;
     _searchService        = searchService;
     _messagingService     = messagingService;
     _tokenService         = tokenService;
     _lockedCallback       = lockedCallback;
     _loggedOutCallback    = loggedOutCallback;
 }
Esempio n. 23
0
 public SyncService(
     IUserService userService,
     IApiService apiService,
     ISettingsService settingsService,
     IFolderService folderService,
     ICipherService cipherService,
     ICryptoService cryptoService,
     ICollectionService collectionService,
     IStorageService storageService,
     IMessagingService messagingService,
     IPolicyService policyService,
     ISendService sendService,
     IKeyConnectorService keyConnectorService,
     Func <bool, Task> logoutCallbackAsync)
 {
     _userService         = userService;
     _apiService          = apiService;
     _settingsService     = settingsService;
     _folderService       = folderService;
     _cipherService       = cipherService;
     _cryptoService       = cryptoService;
     _collectionService   = collectionService;
     _storageService      = storageService;
     _messagingService    = messagingService;
     _policyService       = policyService;
     _sendService         = sendService;
     _keyConnectorService = keyConnectorService;
     _logoutCallbackAsync = logoutCallbackAsync;
 }
Esempio n. 24
0
        public ViewPageViewModel()
        {
            _deviceActionService     = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _cipherService           = ServiceContainer.Resolve <ICipherService>("cipherService");
            _stateService            = ServiceContainer.Resolve <IStateService>("stateService");
            _totpService             = ServiceContainer.Resolve <ITotpService>("totpService");
            _platformUtilsService    = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _auditService            = ServiceContainer.Resolve <IAuditService>("auditService");
            _messagingService        = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _eventService            = ServiceContainer.Resolve <IEventService>("eventService");
            _passwordRepromptService = ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService");
            _localizeService         = ServiceContainer.Resolve <ILocalizeService>("localizeService");
            _clipboardService        = ServiceContainer.Resolve <IClipboardService>("clipboardService");
            _logger = ServiceContainer.Resolve <ILogger>("logger");

            CopyCommand               = new AsyncCommand <string>((id) => CopyAsync(id, null), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
            CopyUriCommand            = new AsyncCommand <LoginUriView>(uriView => CopyAsync("LoginUri", uriView.Uri), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
            CopyFieldCommand          = new AsyncCommand <FieldView>(field => CopyAsync(field.Type == FieldType.Hidden ? "H_FieldValue" : "FieldValue", field.Value), onException: ex => _logger.Exception(ex), allowsMultipleExecutions: false);
            LaunchUriCommand          = new Command <LoginUriView>(LaunchUri);
            TogglePasswordCommand     = new Command(TogglePassword);
            ToggleCardNumberCommand   = new Command(ToggleCardNumber);
            ToggleCardCodeCommand     = new Command(ToggleCardCode);
            CheckPasswordCommand      = new Command(CheckPasswordAsync);
            DownloadAttachmentCommand = new Command <AttachmentView>(DownloadAttachmentAsync);

            PageTitle = AppResources.ViewItem;
        }
 public ExtensionTableSource(AppExtensionContext context, UIViewController controller)
 {
     _accessPremium = Helpers.CanAccessPremium();
     _cipherService = Resolver.Resolve <ICipherService>();
     _settings      = Resolver.Resolve <ISettings>();
     _context       = context;
     _controller    = controller;
 }
Esempio n. 26
0
 public TableSource(LoginListViewController controller)
 {
     _context       = controller.Context;
     _controller    = controller;
     _isPremium     = Resolver.Resolve <ITokenService>()?.TokenPremium ?? false;
     _cipherService = Resolver.Resolve <ICipherService>();
     _settings      = Resolver.Resolve <ISettings>();
 }
Esempio n. 27
0
        public AutofillCiphersPageViewModel()
        {
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _cipherService        = ServiceContainer.Resolve <ICipherService>("cipherService");
            _deviceActionService  = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");

            GroupedItems         = new ExtendedObservableCollection <GroupingsPageListGroup>();
            CipherOptionsCommand = new Command <CipherView>(CipherOptionsAsync);
        }
 public CollectionsPageViewModel()
 {
     _deviceActionService  = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
     _cipherService        = ServiceContainer.Resolve <ICipherService>("cipherService");
     _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
     _collectionService    = ServiceContainer.Resolve <ICollectionService>("collectionService");
     Collections           = new ExtendedObservableCollection <CollectionViewModel>();
     PageTitle             = AppResources.Collections;
 }
Esempio n. 29
0
 public AccountsController(
     IUserService userService,
     ICipherService cipherService,
     UserManager <User> userManager)
 {
     _userService   = userService;
     _cipherService = cipherService;
     _userManager   = userManager;
 }
Esempio n. 30
0
 public LoginsController(
     ICipherRepository cipherRepository,
     ICipherService cipherService,
     IUserService userService)
 {
     _cipherRepository = cipherRepository;
     _cipherService    = cipherService;
     _userService      = userService;
 }
Esempio n. 31
0
 public SitesController(
     ICipherRepository cipherRepository,
     ICipherService cipherService,
     UserManager<User> userManager)
 {
     _cipherRepository = cipherRepository;
     _cipherService = cipherService;
     _userManager = userManager;
 }
Esempio n. 32
0
 public AccountsController(
     IUserService userService,
     ICipherService cipherService,
     UserManager<User> userManager,
     CurrentContext currentContext)
 {
     _userService = userService;
     _cipherService = cipherService;
     _userManager = userManager;
     _currentContext = currentContext;
 }