コード例 #1
0
        //Add the Credentials from the App.config to the Windows Credential Manager
        private void AddCredentials()
        {
            var credentialToolBox = new WindowsCredentialToolBox();

            try
            {
                var credentialConfig = _provideConfiguration.GetConfiguration <CredentialConfigSection>("credentialSection");

                if (credentialConfig != null && credentialConfig.Credentials.Count > 0)
                {
                    foreach (CredentialConfig credential in credentialConfig.Credentials)
                    {
                        credentialToolBox.Add(credential.Target, credential.User, credential.Password.DecodePassword(),
                                              credential.Type, credential.Persist);
                    }
                }
                else
                {
                    Logger.Info("No Credentials available");
                }
            }
            catch (Exception e)
            {
                Logger.Error("Something wrong with the credentialSection in the App.config", e);
            }
        }
コード例 #2
0
 public void Teardown()
 {
     _windowsCredentialToolBox = null;
 }
コード例 #3
0
 public void Setup()
 {
     _windowsCredentialToolBox = new WindowsCredentialToolBox();
 }