コード例 #1
0
        private static LoginViewModel CreateSut(
            IHudUtility hudUtility                   = null,
            IAlertUtility alertUtility               = null,
            ICredentialStorage credentialStorage     = null,
            ICredentialValidator credentialValidator = null,
            IBackgroundSyncUtility backgroundSync    = null
            )
        {
            if (credentialValidator == null)
            {
                credentialValidator = Substitute.For <ICredentialValidator>();

                credentialValidator.ValidateAsync(Arg.Any <Credentials>())
                .Returns(Task.FromResult(Result.Success));
            }

            if (credentialStorage == null)
            {
                credentialStorage = Substitute.For <ICredentialStorage>();

                credentialStorage.SaveCredentialsAsync(Arg.Any <Credentials>())
                .Returns(Task.FromResult(Result.Success));
            }

            return(new LoginViewModel(
                       credentialValidator,
                       credentialStorage,
                       hudUtility ?? Substitute.For <IHudUtility>(),
                       alertUtility ?? Substitute.For <IAlertUtility>(),
                       backgroundSync ?? Substitute.For <IBackgroundSyncUtility>()
                       ));
        }
コード例 #2
0
ファイル: SmartJuickClient.cs プロジェクト: k0st1x/JuickW8
 public SmartJuickClient(ICredentialStorage credentialStorage)
 {
     var credential = credentialStorage.LoadCredential();
     if(credential != null) {
         SetCredential(credential);
     }
 }
コード例 #3
0
ファイル: SmartJuickClient.cs プロジェクト: k0st1x/JuickW8
        public SmartJuickClient(ICredentialStorage credentialStorage)
        {
            var credential = credentialStorage.LoadCredential();

            if (credential != null)
            {
                SetCredential(credential);
            }
        }
コード例 #4
0
 public DiscordClient(IMessageBus messageBus, ICredentialStorage credentialStorage)
 {
     _messageBus     = messageBus;
     DISCORD_BOT_KEY = credentialStorage.GetKey("discord", null);
     _discordClient  = new DiscordSocketClient(new DiscordSocketConfig()
     {
         MessageCacheSize = 150,
         DefaultRetryMode = RetryMode.AlwaysRetry,
     });
 }
コード例 #5
0
        public ConfigManager(ICredentialStorage credentialStorage, IFileSystem fileSystem)
        {
            _credentialStorage = credentialStorage;
            _fileSystem        = fileSystem;

            _localConfigPath = _fileSystem.Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                "Programs",
                "Worms",
                "local.json");
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: Qorpent/qorpent.sys
 /// <summary>
 /// Выполняет установку новых креденций
 /// </summary>
 /// <param name="args"></param>
 public static void Main(string[] args) {
     Storage = Applications.Application.Current.Container.Get<ICredentialStorage>();
     if (null == Storage) {
         throw new Exception("no storage provided");
     }
     if (0 == args.Length) {
         ExecuteInteractive();
     }
     else {
         ExecuteNonInteractive(args);
     }
 }
コード例 #7
0
ファイル: ViewModel.cs プロジェクト: msdiniz/WinRTExamples
        /// <summary>
        /// Initializes a new instance of the <see cref="ViewModel"/> class.
        /// </summary>
        public ViewModel()
        {
            this.credentialStorage = new AppCredentialStorage();
            var googleAuth = new GoogleAuthenticator(this.credentialStorage)
            {
                LogToConsole = this.Log
            };
            var facebookAuth = new FacebookAuthenticator(this.credentialStorage)
            {
                LogToConsole = this.Log
            };

            this.authenticationTypes =
                new List <AuthenticationType>
            {
                new AuthenticationType {
                    Name = "None"
                },
                new AuthenticationType
                {
                    Name     = facebookAuth.Name,
                    Auth     = facebookAuth,
                    Identity = new FacebookIdentity
                    {
                        LogToConsole = this.Log
                    }
                },
                new AuthenticationType
                {
                    Name     = googleAuth.Name,
                    Auth     = googleAuth,
                    Identity = new GoogleIdentity
                    {
                        LogToConsole = this.Log
                    }
                }
            };

            this.selectedType         = this.authenticationTypes[0];
            this.authenticationStatus = "Not Authenticated";
            this.email = "N/A";

            this.Log("Application initialized.");

            if (!Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                return;
            }

            this.Log("This is just a test message.");
            this.Log("To show the console when the display mode is set to design time enabled, and this is specifically a longer message to make it easier to test that text is wrapping appropriately.");
        }
コード例 #8
0
 public WeatherPlugin(ICredentialStorage credentialStorage)
 {
     DARK_SKIES_APIKEY = credentialStorage.GetKey("darkskies", "");
     BING_MAPS_APIKEY  = credentialStorage.GetKey("bing", "");
     try
     {
         _userPostcodes = JsonConvert.DeserializeObject <Dictionary <string, string> >(File.ReadAllText(USER_LOCATION_DIR));
     }
     catch
     {
         // ignore
     }
 }
コード例 #9
0
ファイル: LoginViewModel.cs プロジェクト: k0st1x/JuickW8
        public LoginViewModel(IJuickClient juickClient, ICredentialStorage credentialStorage, INavigationManager navigationManager) {
            this.client = juickClient;
            this.credentialStorage = credentialStorage;
            this.navigationManager = navigationManager;

            LoginCommand = new DelegateCommand(DoLogin);

            var credential = credentialStorage.LoadCredential();
            if(credential != null) {
                login = credential.UserName;
                password = credential.Password;
            }
        }
コード例 #10
0
ファイル: LoginViewModel.cs プロジェクト: aspnetde/IUBH.TOR
 public LoginViewModel(
     ICredentialValidator credentialValidator,
     ICredentialStorage credentialStorage,
     IHudUtility hud,
     IAlertUtility alerts,
     IBackgroundSyncUtility backgroundSync
     )
 {
     _credentialValidator = credentialValidator;
     _credentialStorage   = credentialStorage;
     _hud            = hud;
     _alerts         = alerts;
     _backgroundSync = backgroundSync;
 }
コード例 #11
0
ファイル: App.xaml.cs プロジェクト: aspnetde/IUBH.TOR
        /// <summary>
        /// Returns either the type of the Course List Page (when the user is already
        /// authenticated) or of the Login Page (when the user isn't authenticated).
        /// </summary>
        internal static async Task <Type> InitializeAsync(
            ICredentialStorage credentialStorage,
            IBackgroundSyncUtility backgroundSync
            )
        {
            var credentialsResult =
                await credentialStorage.GetCredentialsAsync().ConfigureAwait(false);

            if (credentialsResult.IsSuccessful)
            {
                backgroundSync.Enable();
            }

            return(credentialsResult.IsSuccessful ? typeof(CourseListPage) : typeof(LoginPage));
        }
コード例 #12
0
 /// <summary>
 /// Выполняет установку новых креденций
 /// </summary>
 /// <param name="args"></param>
 public static void Main(string[] args)
 {
     Storage = Applications.Application.Current.Container.Get <ICredentialStorage>();
     if (null == Storage)
     {
         throw new Exception("no storage provided");
     }
     if (0 == args.Length)
     {
         ExecuteInteractive();
     }
     else
     {
         ExecuteNonInteractive(args);
     }
 }
コード例 #13
0
ファイル: LoginViewModel.cs プロジェクト: k0st1x/JuickW8
        public LoginViewModel(IJuickClient juickClient, ICredentialStorage credentialStorage, INavigationManager navigationManager)
        {
            this.client            = juickClient;
            this.credentialStorage = credentialStorage;
            this.navigationManager = navigationManager;

            LoginCommand = new DelegateCommand(DoLogin);

            var credential = credentialStorage.LoadCredential();

            if (credential != null)
            {
                login    = credential.UserName;
                password = credential.Password;
            }
        }
コード例 #14
0
        protected CredStashBase(ICredentialStorage credentialStorage, IMasterKeyStorage masterKeyStorage, AesCryptoBase aesCrypto)
        {
            if (credentialStorage == null)
            {
                throw new ArgumentNullException("credentialStorage");
            }
            if (masterKeyStorage == null)
            {
                throw new ArgumentNullException("masterKeyStorage");
            }
            if (aesCrypto == null)
            {
                throw new ArgumentNullException("aesCrypto");
            }

            CredentialStorage = credentialStorage;
            MasterKeyStorage  = masterKeyStorage;
            AesCrypto         = aesCrypto;
        }
コード例 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FacebookAuthenticator"/> class.
 /// </summary>
 /// <param name="dataStorage">
 /// The data storage.
 /// </param>
 public FacebookAuthenticator(ICredentialStorage dataStorage)
 {
     this.dataStorage = dataStorage;
 }
コード例 #16
0
ファイル: DiscordClient.cs プロジェクト: shansenault/Coremero
 public DiscordClient(IMessageBus messageBus, ICredentialStorage credentialStorage)
 {
     _messageBus     = messageBus;
     DISCORD_BOT_KEY = credentialStorage.GetKey("discord", null);
     _discordClient  = new DiscordSocketClient();
 }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GoogleAuthenticator"/> class.
 /// </summary>
 /// <param name="dataStorage">
 /// The data storage.
 /// </param>
 public GoogleAuthenticator(ICredentialStorage dataStorage)
 {
     this.dataStorage  = dataStorage;
     this.LogToConsole = delegate { };
 }
コード例 #18
0
 public CoursePageHtmlDownloader(ICredentialStorage credentialStorage)
 {
     _credentialStorage = credentialStorage;
 }
コード例 #19
0
 public Tumblr(ICredentialStorage credentialStorage)
 {
     TUMBLR_API_KEY = credentialStorage.GetKey("tumblr", "fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4");
     // Public testing API key from Tumblr.
 }