示例#1
0
 public SimulatorRuntimeController(ISimulatorNetworkManager simNetworkManager, ISimulatorManager simManager, IAdminLogger logger, ISecureStorage secureStorage)
 {
     _simNetworkManager = simNetworkManager;
     _simManager        = simManager;
     _secureStorage     = secureStorage;
     _logger            = logger;
 }
 public ChooseAssetsViewModel(IAppData appData, IUserData userData, ISecureStorage secureStorage, IUserAssetsService userAssetsService)
 {
     this.appData           = appData;
     this.userData          = userData;
     this.secureStorage     = secureStorage;
     this.userAssetsService = userAssetsService;
 }
示例#3
0
        public LegacyStorageService(ISecureStorage secureStorage, IFileSystem fileSystem)
        {
            SecureStorage = secureStorage ?? throw new ArgumentException(nameof(SecureStorage));

            DbFile        = new FileInfo(Path.Combine(fileSystem.LocalStorage.FullName, DbFileName));
            EncryptionKey = new Lazy <byte[]>(GetEncryptionKey);
        }
 /// <summary>
 /// Method that handles cleanup of the viewmodel
 /// </summary>
 public void Dispose()
 {
     _timerContinue = false;
     Definitions.Report = new DriveReport();
     Unsubscribe();
     _storage = null;
 }
示例#5
0
 public LoginPageViewModel(INavigationService navigationService,
                           IAutApi autApi,
                           ISecureStorage secureStorage) : base(navigationService)
 {
     _autApi        = autApi;
     _secureStorage = secureStorage;
 }
示例#6
0
        public UserRepository(ISecureStorage storage)
        {
            _storage = storage;

            Observable.FromAsync(_ => GetUserAsync())
            .Subscribe(user => _currentUser.Value = user);
        }
示例#7
0
 public MainPageViewModel(INavigationService navigationService, IAutApi autApi, ISecureStorage secureStorage)
     : base(navigationService)
 {
     Title          = "Main Page";
     _autApi        = autApi;
     _secureStorage = secureStorage;
 }
示例#8
0
        public StorageService(ISecureStorage secureStorage, IFileSystem fileSystem)
        {
            SecureStorage = secureStorage ?? throw new ArgumentException(nameof(SecureStorage));
            FileSystem    = fileSystem ?? throw new ArgumentException(nameof(fileSystem));

            DbFile = new FileInfo(Path.Combine(fileSystem.LocalStorage.FullName, DbFileName));
        }
示例#9
0
        public VacationContext(ISecureStorage storage)
        {
            var token = storage.GetAsync(Settings.TokenStorageKey).Result;

            _client = new HttpClient();
            _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
        }
 public MainPageViewModel(INavigationService navigationService, ISecureStorage secureStorage)
     : base(navigationService)
 {
     this.secureStorage      = secureStorage;
     this._navigationService = navigationService;
     Title = "Main Page";
 }
示例#11
0
        public static Account[] OpenVaultBrowser(string username,
                                                 string password,
                                                 string deviceId,
                                                 string baseUrl,
                                                 IUi ui,
                                                 ISecureStorage storage,
                                                 IRestTransport transport)
        {
            // Reset to default. Let the user simply pass a null or "" and not bother with an overload.
            if (baseUrl.IsNullOrEmpty())
            {
                baseUrl = DefaultBaseUrl;
            }

            var rest = new RestClient(transport, baseUrl, defaultHeaders: DefaultRestHeaders);

            // 1. Request the number of KDF iterations needed to derive the key
            var iterations = RequestKdfIterationCount(username, rest);

            // 2. Derive the master encryption key or KEK (key encryption key)
            var key = Util.DeriveKey(username, password, iterations);

            // 3. Hash the password that is going to be sent to the server
            var hash = Util.HashPassword(password, key);

            // 4. Authenticate with the server and get the token
            var token = Login(username, hash, deviceId, ui, storage, rest);

            // 5. Fetch the vault
            var encryptedVault = DownloadVault(rest, token);

            // 6. Decrypt and parse the vault. Done!
            return(DecryptVault(encryptedVault, key));
        }
 public ServiceTicketTemplateManager(IServiceTicketTemplateRepo repo, ITemplateCategoryRepo templateCategoryRepo, IAppConfig appConfig, IAdminLogger logger, ISecureStorage secureStorage,
                                     IDependencyManager depmanager, ISecurity security) : base(logger, appConfig, depmanager, security)
 {
     _repo                 = repo;
     _secureStorage        = secureStorage;
     _templateCategoryRepo = templateCategoryRepo;
 }
示例#13
0
 public SyncfusionService(AzureFunctionsApiService azureFunctionsApiService,
                          IAnalyticsService analyticsService,
                          ISecureStorage secureStorage)
 {
     _secureStorage            = secureStorage;
     _analyticsService         = analyticsService;
     _azureFunctionsApiService = azureFunctionsApiService;
 }
 public ContainerRepositoryManager(IContainerRepositoryRepo repo, ISecureStorage secureStorage, IAdminLogger logger, Services.IDockerRegisteryServices dockerRegistryServices,
                                   IAppConfig appConfig, IDependencyManager dependencyManager, ISecurity security)
     : base(logger, appConfig, dependencyManager, security)
 {
     _repo                   = repo;
     _secureStorage          = secureStorage;
     _dockerRegistryServices = dockerRegistryServices;
 }
示例#15
0
        public ClientService(ILogger logger, ISecureStorage secureStorage) : base()
        {
            _logger        = logger;
            _secureStorage = secureStorage;

            Posts    = new List <Post>();
            Comments = new List <Comment>();
        }
        public EventListPageViewModel(INavigationService navigationService)
            : base(navigationService)
        {
            _secureStorage = CrossSecureStorage.Current;

            BackCommand   = new Command(async() => await BackButton());
            CreateCommand = new Command(async() => await CreateButton());
        }
示例#17
0
 // TODO: Write a test that runs the whole sequence and checks the result.
 internal static Vault Open(string username,
                            string password,
                            Ui ui,
                            ISecureStorage storage,
                            IRestTransport transport)
 {
     return(new Vault(Client.OpenVault(username, password, ui, storage, transport)));
 }
        public RegisterPage()
        {
            NavigationPage.SetHasBackButton(this, false);

            InitializeComponent();
            _storage = App.Resolve <IStorage>().SecureStorage;
            _navi    = App.Resolve <IAppNavigation>();
        }
示例#19
0
 public ClientAppManager(IClientAppRepo repo, IAppConfig appConfig, IAdminLogger logger, ISecureStorage secureStorage,
                         IUserManager userManager, IOrganizationManager orgManager, IDependencyManager depmanager, ISecurity security) : base(logger, appConfig, depmanager, security)
 {
     _repo          = repo ?? throw new ArgumentNullException(nameof(repo));
     _appConfig     = appConfig ?? throw new ArgumentNullException(nameof(appConfig));
     _secureStorage = secureStorage ?? throw new ArgumentNullException(nameof(secureStorage));
     _userManager   = userManager ?? throw new ArgumentNullException(nameof(userManager));
     _orgManager    = orgManager ?? throw new ArgumentNullException(nameof(orgManager));
 }
        public SecurityManager(ISecureStorage storage)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }

            this.storage = storage;
        }
示例#21
0
 public PinSignInViewModel(IViewService viewService, ISecureStorage secureStorage, IAppData appData, Func <MainViewModel> createMainViewModel)
 {
     this.viewService         = viewService;
     this.secureStorage       = secureStorage;
     this.appData             = appData;
     this.createMainViewModel = createMainViewModel;
     SignInCommand            = new XCommand(SignIn);
     SignInCommand.SetDependency(this);
 }
 public OrderNewCardViewModel(ISecureStorage secureStorage, IConnectivity connectivity, ICardOrderService cardOrderService, ICardData cardData, IAppData appData, Func <EditAddressViewModel> createEditAddressViewModel)
 {
     this.secureStorage              = secureStorage;
     this.connectivity               = connectivity;
     this.cardOrderService           = cardOrderService;
     this.cardData                   = cardData;
     this.appData                    = appData;
     this.createEditAddressViewModel = createEditAddressViewModel;
 }
示例#23
0
 public static int?GetUserId(this ISecureStorage secureStorage)
 {
     if (secureStorage.HasKey(UserIdkey))
     {
         int.TryParse(secureStorage.GetValue(UserIdkey), out int result);
         return(result);
     }
     return(null);
 }
示例#24
0
        public static T Get <T>() where T : new()
        {
            ISecureStorage SecureStorage = DependencyService.Get <ISecureStorage>();
            var            json          = SecureStorage.Get(typeof(T).Name);

            return(!string.IsNullOrEmpty(json)
                ? JsonConvert.DeserializeObject <T>(json)
                : new T());
        }
 public LoginProvider(IAppSettings appSettings, ISecureStorage secureStorage, ILoggingService loggingService,
                      IDeviceInfo deviceInfo, IVersionTracking versionTracking)
 {
     _appSettings     = appSettings;
     _secureStorage   = secureStorage;
     _loggingService  = loggingService;
     _deviceInfo      = deviceInfo;
     _versionTracking = versionTracking;
 }
示例#26
0
 public DeviceManager(IDeviceManagementRepo deviceRepo, IDeviceManagementConnector deviceConnectorService,
                      IDeviceConfigHelper deviceConfigHelper, IAdminLogger logger, ISecureStorage secureStorage,
                      IAppConfig appConfig, IDependencyManager depmanager, ISecurity security) : base(logger, appConfig, depmanager, security)
 {
     _deviceRepo             = deviceRepo;
     _secureStorage          = secureStorage;
     _deviceConfigHelper     = deviceConfigHelper;
     _deviceConnectorService = deviceConnectorService;
 }
示例#27
0
        /// <summary>
        /// Method is used a a constructor, because the constructor needs to be parameterless
        /// </summary>
        public void InitVm(Municipality m)
        {
            _model = m;

            // URL for testserver
           //_model.APIUrl = "http://os2indberetningmobil/api";

            _storage = DependencyService.Get<ISecureStorage>();
        }
示例#28
0
        internal static void SaveRememberMeToken(TokenOrSecondFactor reseponse, ISecureStorage storage)
        {
            var token = reseponse.RememberMeToken;

            if (token != null)
            {
                storage.StoreString(RememberMeTokenKey, token);
            }
        }
示例#29
0
 public LoggedInUserService(IUserDataManager userDataManager,
                            IUserDataManager dataManager,
                            IUserDataRealmManager dataRealmManager)
 {
     _userDataManager  = userDataManager;
     _dataManager      = dataManager;
     _dataRealmManager = dataRealmManager;
     _secureStorage    = CrossSecureStorage.Current;
 }
示例#30
0
        //Task ReceivingTask;
        #endregion

        #region Constructor
        public SimulatorViewModel(ISecureStorage secureStorage)
        {
            ConnectCommand              = new RelayCommand(Connect);
            DisconnectCommand           = new RelayCommand(Disconnect);
            ShowMessageTemplatesCommand = new RelayCommand(ShowMessageTemplates);
            ShowReceivedMessagesCommand = new RelayCommand(ShowReceivedMessages);
            ReceivedMessageList         = new ObservableCollection <ReceivedMessage>();
            _secureStorage              = secureStorage;
        }
        /// <summary>
        /// Constructor that handles initialization of the viewmodel
        /// </summary>
        public UploadingViewModel()
        {
            UploaderText = "Uploader kørselsdata";
            _storage = DependencyService.Get<ISecureStorage>();
            var tokenByte = _storage.Retrieve(Definitions.AuthKey);
            Definitions.Purpose = null;
            _authorization = JsonConvert.DeserializeObject<Authorization>(Encoding.UTF8.GetString(tokenByte, 0, tokenByte.Length));

            Subscribe();
        }
        /// <summary>
        /// Constructor that handles initialization of the viewmodel
        /// </summary>
        public MainViewModel()
        {
            PrimaryHex = Color.FromHex(Definitions.PrimaryColor);
            if (Definitions.Report == null)
            {
                Definitions.Report = new DriveReport();
            }
            
            _driveReport = new ObservableCollection<DriveReportCellModel>();
            _storage = DependencyService.Get<ISecureStorage>();
            Subscribe();

            FileHandler.ReadFileContent(Definitions.OrganizationFileName, Definitions.OrganizationFolder).ContinueWith(
             (result) =>
             {
                 if (!string.IsNullOrEmpty(result.Result))
                 {
                     var obj = JsonConvert.DeserializeObject<Employment>(result.Result);
                     Definitions.Report.EmploymentId = obj.Id;
                     Definitions.Organization = obj;
                 }
                 FileHandler.ReadFileContent(Definitions.TaxeFileName, Definitions.TaxeFolder).ContinueWith(
                    (result2) =>
                    {
                        if (!string.IsNullOrEmpty(result2.Result))
                        {
                            var obj = JsonConvert.DeserializeObject<Rate>(result2.Result);
                            Definitions.Report.RateId = obj.Id;
                            Definitions.Rate = obj;
                        }
                    }, TaskScheduler.FromCurrentSynchronizationContext()).ContinueWith( (result3) =>
                    {
                        InitializeCollection();
                    });
                 }, TaskScheduler.FromCurrentSynchronizationContext());
            }
示例#33
0
 /// <summary>
 /// Create a new instance of the AccountHelper.
 /// </summary>
 /// <param name="storage">The secure storage implemenation to use for fetching and setting values securely.</param>
 public AccountHelper(ISecureStorage storage)
 {
     this.storage = storage;
 }