当前位置: 首页>>代码示例>>C#>>正文


C# PasswordVault.RetrieveAll方法代码示例

本文整理汇总了C#中Windows.Security.Credentials.PasswordVault.RetrieveAll方法的典型用法代码示例。如果您正苦于以下问题:C# PasswordVault.RetrieveAll方法的具体用法?C# PasswordVault.RetrieveAll怎么用?C# PasswordVault.RetrieveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.Security.Credentials.PasswordVault的用法示例。


在下文中一共展示了PasswordVault.RetrieveAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSecretFor

        public string GetSecretFor(string name)
        {
            var vault = new PasswordVault();
            try
            {
                if (vault.RetrieveAll().Count == 0)
                {
                    return "";
                }

                var credentialList = vault.FindAllByResource(_key);

                return credentialList
                    .Where(x => x.UserName == name)
                    .Select(x =>
                    {
                        x.RetrievePassword();
                        return x.Password;
                    })
                    .FirstOrDefault();
            }
            catch (Exception)
            {
                // Exception is thrown if the vault isn't properly initialised
                return "";
            }
        }
开发者ID:alexhardwicke,项目名称:Auth,代码行数:27,代码来源:PasswordHelper.cs

示例2: ClearRoamedAccounts

        public static void ClearRoamedAccounts()
        {
            PasswordVault vault = new PasswordVault();

            foreach (var credential in vault.RetrieveAll())
            {
                vault.Remove(credential);
            }
        }
开发者ID:mbmccormick,项目名称:Authenticator,代码行数:9,代码来源:AccountManager.cs

示例3: GetPassword

        public static string GetPassword()
        {
            PasswordVault passwordVault = new PasswordVault();
            if (!passwordVault.RetrieveAll().Any(credential => credential.UserName == UserNameText && credential.Resource == ResourceText))
            {
                SetPassword();
            }

            return passwordVault.Retrieve(ResourceText, UserNameText).Password;
        }
开发者ID:QRyptoWire,项目名称:qrypto-wire,代码行数:10,代码来源:QryptoDbSecurity.cs

示例4: InitializePasswordVaultInTheBackground

 static bool InitializePasswordVaultInTheBackground()
 {
     // Explicitly place this task on a background thread.
     Task.Factory.StartNew(() =>
     {
         // any call to the password vault will load the vault.
         var vault = new PasswordVault();
         vault.RetrieveAll();
     });
     return true;
 }
开发者ID:COMIsLove,项目名称:Windows-universal-samples,代码行数:11,代码来源:SampleConfiguration.cs

示例5: GetLoginInfo

        public Tuple<string, string> GetLoginInfo()
        {
            var passwordValut = new Windows.Security.Credentials.PasswordVault();
            var list = passwordValut.RetrieveAll();

            var login = list.FirstOrDefault(i => String.Compare(i.Resource, RESOURCE) == 0);
            if (login != null)
            {
                login.RetrievePassword();
                return new Tuple<string, string>(login.UserName, login.Password);
            }
            return new Tuple<string, string>(String.Empty, String.Empty);
        }
开发者ID:holtsoftware,项目名称:bearded-avenger,代码行数:13,代码来源:WindowsLoginStore.cs

示例6: SaveIfttt

        public void SaveIfttt(string key)
        {
            if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));

            var vault = new PasswordVault();

            foreach (var item in vault.RetrieveAll().Where(v => v.Resource == "ifttt"))
            {
                vault.Remove(item);
            }

            vault.Add(new PasswordCredential("ifttt", "key", key));
        }
开发者ID:danpadmore,项目名称:homebased,代码行数:13,代码来源:CredentialsRepository.cs

示例7: GetIfttt

        public string GetIfttt()
        {
            var vault = new PasswordVault();

            var credentials = vault.RetrieveAll().Where(v => v.Resource == "ifttt");
            if (credentials.Count(c => c.UserName == "key") != 1)
                return null;

            var key = credentials.Single();
            key.RetrievePassword();

            return key.Password;
        }
开发者ID:danpadmore,项目名称:homebased,代码行数:13,代码来源:CredentialsRepository.cs

示例8: MainPage_AccountCommandsRequested

        private void MainPage_AccountCommandsRequested(AccountsSettingsPane sender,
			AccountsSettingsPaneCommandsRequestedEventArgs args)
        {
            var credDeletedHandler = new CredentialCommandCredentialDeletedHandler(h => AccountsSettingsPane.Show());

            var vault = new PasswordVault();
            var creds = vault.RetrieveAll();

            foreach (PasswordCredential c in creds)
            {
                var credCommand1 = new CredentialCommand(c, credDeletedHandler);
                args.CredentialCommands.Add(credCommand1);
            }
        }
开发者ID:robledop,项目名称:Demos-20485,代码行数:14,代码来源:MainPage.xaml.cs

示例9: SetNotifierCredential

 public static void SetNotifierCredential(string username, string password)
 {
     var vault = new PasswordVault();
     var credentials = vault.RetrieveAll();
     foreach (var credential in credentials)
     {
         if (credential.Resource == "NOTCRED" && credential.UserName == username)
         {
             vault.Remove(credential);
         }
     }
     if (password != null)
     {
         vault.Add(new PasswordCredential("NOTCRED", username, password));
     }
 }
开发者ID:nidzo732,项目名称:SecureMessaging,代码行数:16,代码来源:DataStorage.cs

示例10: GetNotifierCredentials

 public static List<string[]> GetNotifierCredentials()
 {
     List<string[]> returnedCredentials = new List<string[]>();
     var vault = new PasswordVault();
     var credentials = vault.RetrieveAll();
     if (credentials.Count == 0) return returnedCredentials;
     foreach (var credential in credentials)
     {
         if (credential.Resource == "NOTCRED")
         {
             credential.RetrievePassword();
             string[] credentialData = { credential.UserName, credential.Password };
             returnedCredentials.Add(credentialData);
         }
     }
     return returnedCredentials;
 }
开发者ID:nidzo732,项目名称:SecureMessaging,代码行数:17,代码来源:DataStorage.cs

示例11: DeserializeRoamedAccounts

        public static void DeserializeRoamedAccounts()
        {
            PasswordVault vault = new PasswordVault();

            App.Accounts.Clear();

            foreach (var credential in vault.RetrieveAll())
            {
                credential.RetrievePassword();

                Account a = new Account();
                a.Name = credential.UserName;
                a.SecretKey = credential.Password;

                App.Accounts.Add(a);
            }
        }
开发者ID:mbmccormick,项目名称:Authenticator,代码行数:17,代码来源:AccountManager.cs

示例12: SaveSettings

        private bool SaveSettings(string user, string password, string host, string port, Scheme scheme)
        {
            var vault = new PasswordVault();
            foreach (var pwdCredential in vault.RetrieveAll())
            {
                vault.Remove(pwdCredential);
            }

            vault.Add(new PasswordCredential(ResourceName, user, password));

            var res = vault.FindAllByUserName(user);
            ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
            localSettings.Values["host"] = host;
            localSettings.Values["scheme"] = scheme.ToString();
            localSettings.Values["port"] = port.ToString();       
            MainPage.SplunkService = null;
            return true;
        }
开发者ID:Netsuye,项目名称:Splunk-SDK,代码行数:18,代码来源:ConnectSetting.xaml.cs

示例13: SaveLogin

 public void SaveLogin(string username, string password)
 {
     PasswordCredential pc;
     var passwordVault = new Windows.Security.Credentials.PasswordVault();
     var list = passwordVault.RetrieveAll().Where(i => String.Compare(i.Resource, RESOURCE) == 0);
     if((pc = list.FirstOrDefault(i => String.Compare(i.UserName, username) == 0)) != null)
     {
         passwordVault.Remove(pc);
         passwordVault.Add(new Windows.Security.Credentials.PasswordCredential(RESOURCE, username, password));
     }
     else if(list.Count() > 0)
     {
         foreach(var p in list)
         {
             passwordVault.Remove(p);
         }
     }
     passwordVault.Add(new Windows.Security.Credentials.PasswordCredential(RESOURCE, username, password));
 }
开发者ID:holtsoftware,项目名称:bearded-avenger,代码行数:19,代码来源:WindowsLoginStore.cs

示例14: SaveFifthplay

        public void SaveFifthplay(string username, string password)
        {
            if (username == null) throw new ArgumentNullException(nameof(username));
            if (password == null) throw new ArgumentNullException(nameof(password));

            var vault = new PasswordVault();

            foreach (var item in vault.RetrieveAll().Where(v => v.Resource == "fifthplay"))
            {
                vault.Remove(item);
            }

            vault.Add(new PasswordCredential("fifthplay", username, password));

            if (!ApplicationData.Current.LocalSettings.Values.ContainsKey("fifthplay-username"))
                ApplicationData.Current.LocalSettings.Values.Add("fifthplay-username", username);
            else
                ApplicationData.Current.LocalSettings.Values["fifthplay-username"] = username;
        }
开发者ID:danpadmore,项目名称:homebased,代码行数:19,代码来源:CredentialsRepository.cs

示例15: ReadAll

        public IList<SecureAuthCode> ReadAll()
        {
            var vault = new PasswordVault();
            try
            {
                if (vault.RetrieveAll().Count == 0)
                {
                    return new List<SecureAuthCode>();
                }

                var credentialList = vault.FindAllByResource(_key);

                return credentialList.Select(x =>
                {
                    x.RetrievePassword();
                    return new SecureAuthCode(x.UserName, x.Password);
                }).ToList();
            }
            catch (Exception)
            {
                // Exception is thrown if the vault isn't properly initialised
                return new List<SecureAuthCode>();
            }
        }
开发者ID:alexhardwicke,项目名称:Auth,代码行数:24,代码来源:PasswordHelper.cs


注:本文中的Windows.Security.Credentials.PasswordVault.RetrieveAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。