Exemple #1
0
    private void GetUserCredentials()
    {
        if (credentials != null)
        {
            return;
        }
        string login = GetLogin();

        credentials = new TFCredential(login);
    }
        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;
        }
Exemple #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);
        }
        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();
        }
Exemple #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);
    }
Exemple #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();
        }
Exemple #7
0
 private void GetUserCredentials()
 {
     if (credentials != null) return;
     string login = GetLogin();
     credentials = new TFCredential(login);
 }
Exemple #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;
    }