Ejemplo n.º 1
0
		protected sealed override PasswordAuthentication GetPasswordAuthentication()
		{
			string host = GetRequestingHost();
			int port = GetRequestingPort();
			foreach (CachedAuthenticator.CachedAuthentication ca in cached)
			{
				if (ca.host.Equals(host) && ca.port == port)
				{
					return ca.ToPasswordAuthentication();
				}
			}
			PasswordAuthentication pa = PromptPasswordAuthentication();
			if (pa != null)
			{
				CachedAuthenticator.CachedAuthentication ca_1 = new CachedAuthenticator.CachedAuthentication
					(host, port, pa.GetUserName(), new string(pa.GetPassword()));
				Add(ca_1);
				return ca_1.ToPasswordAuthentication();
			}
			return null;
		}
Ejemplo n.º 2
0
        protected sealed override PasswordAuthentication GetPasswordAuthentication()
        {
            string host = GetRequestingHost();
            int    port = GetRequestingPort();

            foreach (CachedAuthenticator.CachedAuthentication ca in cached)
            {
                if (ca.host.Equals(host) && ca.port == port)
                {
                    return(ca.ToPasswordAuthentication());
                }
            }
            PasswordAuthentication pa = PromptPasswordAuthentication();

            if (pa != null)
            {
                CachedAuthenticator.CachedAuthentication ca_1 = new CachedAuthenticator.CachedAuthentication
                                                                    (host, port, pa.GetUserName(), new string(pa.GetPassword()));
                Add(ca_1);
                return(ca_1.ToPasswordAuthentication());
            }
            return(null);
        }
Ejemplo n.º 3
0
 /// <summary>Add a cached authentication for future use.</summary>
 /// <remarks>Add a cached authentication for future use.</remarks>
 /// <param name="ca">the information we should remember.</param>
 public static void Add(CachedAuthenticator.CachedAuthentication ca)
 {
     cached.AddItem(ca);
 }