Beispiel #1
0
 internal static GitCredentials.Entry CreatEntry(string url, string username, string password)
 {
     GitCredentials.Entry entry = GitManager.GitCredentials.GetEntry(url);
     if (entry != null)
     {
         return(null);
     }
     entry = new GitCredentials.Entry()
     {
         URL = url
     };
     entry.SetUsername(username);
     GitManager.GitCredentials.AddEntry(entry);
     SetNewPassword(url, username, password);
     return(entry);
 }
Beispiel #2
0
        internal static string LoadPassword(GitCredentials.Entry entry)
        {
            string pass = null;

            if (SeletedAdapter != null)
            {
                try
                {
                    if (!SeletedAdapter.LoadPassword(SeletedAdapter.FormatUrl(entry.URL), ref pass))
                    {
                        Debug.LogFormat("Could not load password with URL: {0} from {1}", entry.URL, GetAdapterName(SeletedAdapter));
                    }
                }
                catch (Exception e)
                {
                    Debug.LogError("There was an error while trying to load credentials from Windows Credentials Manager");
                    Debug.LogException(e);
                }
            }

            return(pass ?? entry.DecryptPassword());
        }