public virtual Credentials GetCredentials(AuthScope authscope) { Args.NotNull(authscope, "Auth scope"); Credentials localcreds = @internal.GetCredentials(authscope); if (localcreds != null) { return(localcreds); } if (authscope.GetHost() != null) { PasswordAuthentication systemcreds = GetSystemCreds(authscope, Authenticator.RequestorType .Server); if (systemcreds == null) { systemcreds = GetSystemCreds(authscope, Authenticator.RequestorType.Proxy); } if (systemcreds != null) { return(new UsernamePasswordCredentials(systemcreds.GetUserName(), new string(systemcreds .GetPassword()))); } } return(null); }
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); }