protected bool Authenticate(out string username, out string password) { if (AuthenticationPrompt == null) { username = ""; password = ""; return(false); } else { WebBrowserAuthenticationPromptEventArgs args = new WebBrowserAuthenticationPromptEventArgs(); AuthenticationPrompt(this, args); username = args.Username; password = args.Password; return(args.Success); } }
/// <summary> /// Nothrow guarantee. /// </summary> void Browser_AuthenticationPrompt(WebBrowser2 sender, WebBrowserAuthenticationPromptEventArgs e) { try { Program.AssertOnEventThread(); log.Debug("Prompting for authentication..."); CompleteClearSecret(lastBrowserState); CompleteGetSecret(lastBrowserState); BrowserState.BrowserCredentials creds = lastBrowserState.Credentials; if (creds != null && creds.Valid) { e.Username = creds.Username; e.Password = creds.Password; e.Success = true; log.Debug("Prompt for authentication successful."); } else { e.Success = false; log.Debug("Prompt for authentication cancelled / failed."); } } catch (Exception exn) { log.Error("Prompt for authentication failed", exn); e.Success = false; } }
protected bool Authenticate(out string username, out string password) { if (AuthenticationPrompt == null) { username = ""; password = ""; return false; } else { WebBrowserAuthenticationPromptEventArgs args = new WebBrowserAuthenticationPromptEventArgs(); AuthenticationPrompt(this, args); username = args.Username; password = args.Password; return args.Success; } }