Ejemplo n.º 1
0
 private static void UpdateSelectedAdaptor(ICredentialsAdapter adapter)
 {
     foreach (var credential in GitManager.GitCredentials)
     {
         credential.ClearPassword();
         credential.SetHasPassword(false);
     }
 }
Ejemplo n.º 2
0
        private static string GetAdapterId(ICredentialsAdapter adapter)
        {
            CredentialsAdapterAttribute attribute = adapter.GetType().GetCustomAttributes(typeof(CredentialsAdapterAttribute), false).FirstOrDefault() as CredentialsAdapterAttribute;

            if (attribute == null)
            {
                return("");
            }
            return(attribute.Id);
        }
Ejemplo n.º 3
0
        private static bool IsValid(ICredentialsAdapter adapter)
        {
            CredentialsAdapterAttribute attribute = adapter.GetType().GetCustomAttributes(typeof(CredentialsAdapterAttribute), false).FirstOrDefault() as CredentialsAdapterAttribute;

            if (attribute == null)
            {
                return(false);
            }
            return(attribute.Id.Equals(GitManager.Settings.CredentialsManager, StringComparison.InvariantCultureIgnoreCase));
        }
Ejemplo n.º 4
0
 private void ResetSelectedAdapter(ICredentialsAdapter lastAdapter)
 {
     if (lastAdapter == null || gitCredentials == null)
     {
         return;
     }
     foreach (var credential in gitCredentials)
     {
         lastAdapter.DeleteCredentials(credential.URL);
     }
 }
Ejemplo n.º 5
0
 private static void ResetSelectedAdapter(ICredentialsAdapter lastAdapter)
 {
     if (lastAdapter == null)
     {
         return;
     }
     foreach (var credential in GitManager.GitCredentials)
     {
         lastAdapter.DeleteCredentials(credential.URL);
         credential.SetHasPassword(false);
     }
 }
Ejemplo n.º 6
0
 internal static void SetSelectedAdapter(int index)
 {
     if (index >= adapters.Length || index < 0 || selectedAdapterIndex == index)
     {
         GitManager.Repository.Config.Set("credential.helper", "");
         ResetSelectedAdapter(selectedAdapter);
         selectedAdapterIndex = -1;
         selectedAdapter      = null;
         return;
     }
     selectedAdapterIndex = index;
     selectedAdapter      = adapters[index];
     GitManager.Repository.Config.Set("credential.helper", GetAdapterId(selectedAdapter));
 }
Ejemplo n.º 7
0
        private string GetAdapterName(ICredentialsAdapter adapter)
        {
            if (adapter == null)
            {
                return("None");
            }
            CredentialsAdapterAttribute attribute = adapter.GetType().GetCustomAttributes(typeof(CredentialsAdapterAttribute), false).FirstOrDefault() as CredentialsAdapterAttribute;

            if (attribute == null)
            {
                return("");
            }
            return(attribute.Name);
        }
Ejemplo n.º 8
0
 internal void SetSelectedAdapter(int index, bool deletePasswords)
 {
     if (index >= adapters.Length || index < 0)
     {
         gitManager.Repository.Config.Set("credential.helper", "");
         if (deletePasswords)
         {
             ResetSelectedAdapter(selectedAdapter);
         }
         gitSettings.CredentialsManager = "";
         gitSettings.MarkDirty();
         selectedAdapterIndex = -1;
         selectedAdapter      = null;
         return;
     }
     selectedAdapterIndex           = index;
     selectedAdapter                = adapters[index];
     gitSettings.CredentialsManager = GetAdapterId(selectedAdapter);
     gitManager.Repository.Config.Set("credential.helper", GetAdapterId(selectedAdapter));
     gitSettings.MarkDirty();
 }
Ejemplo n.º 9
0
        private bool IsValid(ICredentialsAdapter adapter)
        {
            string adapterId = GetAdapterId(adapter);

            return(adapterId.Equals(gitSettings.CredentialsManager, StringComparison.InvariantCultureIgnoreCase));
        }