Esempio n. 1
0
    private void GetUserCredentials()
    {
        if (credentials != null)
        {
            return;
        }
        string login = GetLogin();

        credentials = new TFCredential(login);
    }
Esempio n. 2
0
        public ICredentials GetCredentials(Uri uri, ICredentials failedCredentials)
        {
            NetworkCredential creds = credentialCache.GetCredential(uri, "NTLM");
            if (creds != null) return creds;

            string login = PromptForLogin(uri.ToString());
            creds = new TFCredential(login);

            credentialCache.Add(uri, "NTLM", creds);
            return creds;
        }
Esempio n. 3
0
        public ICredentials GetCredentials(Uri uri, ICredentials failedCredentials)
        {
            NetworkCredential creds = credentialCache.GetCredential(uri, "NTLM");

            if (creds != null)
            {
                return(creds);
            }

            string login = PromptForLogin(uri.ToString());

            creds = new TFCredential(login);

            credentialCache.Add(uri, "NTLM", creds);
            return(creds);
        }
Esempio n. 4
0
        public void AddRepositoryHandler(object sender, EventArgs e)
        {
            RepositoryDialog dialog = new RepositoryDialog(null);

            if (dialog.Run() == (int)ResponseType.Ok)
            {
                try
                {
                    ICredentials         creds = new TFCredential(dialog.Username, dialog.Password);
                    TeamFoundationServer tfs   = TeamFoundationServerFactory.GetServer(dialog.Server, creds);

                    VersionControlServer vcs = tfs.GetService(typeof(VersionControlServer)) as VersionControlServer;
                    vcs.CreateWorkspace(dialog.WorkspaceName, dialog.Username,
                                        "Created by OpenTF Gui", null, Environment.MachineName);
                }
                catch (WebException ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }

            dialog.Destroy();
        }
Esempio n. 5
0
    // ICredentialsProvider method
    public ICredentials GetCredentials(Uri uri, ICredentials failedCredentials)
    {
        NetworkCredential creds = credentialCache.GetCredential(uri, "NTLM");

        if (creds != null)
        {
            return(creds);
        }

        string url   = uri.ToString();
        string login = GetLogin(url);

        if (String.IsNullOrEmpty(login))
        {
            return(null);
        }
        creds = new TFCredential(login);

        if (!(String.IsNullOrEmpty(creds.UserName)) &&
            String.IsNullOrEmpty(creds.Password) && !Options.NoPrompt)
        {
            Console.Write("Password: "******"Credentials.Save");

        if (saveSetting && !String.IsNullOrEmpty(Options.Login))
        {
            Keyring.SetCredentials(url, creds.Domain, creds.UserName, creds.Password);
        }

        credentialCache.Add(uri, "NTLM", creds);
        return(creds);
    }
Esempio n. 6
0
        public void AddRepositoryHandler(object sender, EventArgs e)
        {
            RepositoryDialog dialog = new RepositoryDialog(null);
            if (dialog.Run() == (int)ResponseType.Ok)
            {
                try
                    {
                        ICredentials creds = new TFCredential(dialog.Username, dialog.Password);
                        TeamFoundationServer tfs = TeamFoundationServerFactory.GetServer(dialog.Server, creds);

                        VersionControlServer vcs = tfs.GetService(typeof(VersionControlServer)) as VersionControlServer;
                        vcs.CreateWorkspace(dialog.WorkspaceName, dialog.Username,
                                                                "Created by OpenTF Gui", null, Environment.MachineName);
                    }
                catch (WebException ex)
                    {
                        Console.WriteLine(ex.ToString());
                    }
            }

            dialog.Destroy();
        }
Esempio n. 7
0
 private void GetUserCredentials()
 {
     if (credentials != null) return;
     string login = GetLogin();
     credentials = new TFCredential(login);
 }
Esempio n. 8
0
    // ICredentialsProvider method
    public ICredentials GetCredentials(Uri uri, ICredentials failedCredentials)
    {
        NetworkCredential creds = credentialCache.GetCredential(uri, "NTLM");
        if (creds != null) return creds;

        string url = uri.ToString();
        string login = GetLogin(url);

        if (String.IsNullOrEmpty(login)) return null;
        creds = new TFCredential(login);

        if (!(String.IsNullOrEmpty(creds.UserName)) &&
                String.IsNullOrEmpty(creds.Password) && !Options.NoPrompt)
            {
                Console.Write("Password: "******"Credentials.Save");
        if (saveSetting && !String.IsNullOrEmpty(Options.Login))
            Keyring.SetCredentials(url, creds.Domain, creds.UserName, creds.Password);

        credentialCache.Add(uri, "NTLM", creds);
        return creds;
    }