private void AuthenticationMethod_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
 {
     if (this.AuthenticationPrompt != null)
     {
         this.AuthenticationPrompt(sender, e);
     }
 }
コード例 #2
0
 void OnAuthPrompt(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (var prompt in e.Prompts)
     {
         prompt.Response = Password;
     }
 }
コード例 #3
0
        /// <summary>
        /// Handles the MessageReceived event of the session.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The event data.</param>
        protected override void Session_MessageReceived(object sender, MessageEventArgs <Message> e)
        {
            var informationRequestMessage = e.Message as InformationRequestMessage;

            if (informationRequestMessage != null)
            {
                var eventArgs = new AuthenticationPromptEventArgs(this.Username, informationRequestMessage.Instruction, informationRequestMessage.Language, informationRequestMessage.Prompts);

                this.ExecuteThread(() =>
                {
                    try
                    {
                        if (this.AuthenticationPrompt != null)
                        {
                            this.AuthenticationPrompt(this, eventArgs);
                        }

                        var informationResponse = new InformationResponseMessage();

                        foreach (var response in from r in eventArgs.Prompts orderby r.Id ascending select r.Response)
                        {
                            informationResponse.Responses.Add(response);
                        }

                        //  Send information response message
                        this.SendMessage(informationResponse);
                    }
                    catch (Exception exp)
                    {
                        this._exception = exp;
                        this._authenticationCompleted.Set();
                    }
                });
            }
        }
コード例 #4
0
        private void Session_UserAuthenticationInformationRequestReceived(object sender, MessageEventArgs <InformationRequestMessage> e)
        {
            var informationRequestMessage = e.Message;

            var eventArgs = new AuthenticationPromptEventArgs(Username,
                                                              informationRequestMessage.Instruction,
                                                              informationRequestMessage.Language,
                                                              informationRequestMessage.Prompts);

            ThreadAbstraction.ExecuteThread(() =>
            {
                try
                {
                    if (AuthenticationPrompt != null)
                    {
                        AuthenticationPrompt(this, eventArgs);
                    }

                    var informationResponse = new InformationResponseMessage();

                    foreach (var response in from r in eventArgs.Prompts orderby r.Id ascending select r.Response)
                    {
                        informationResponse.Responses.Add(response);
                    }

                    //  Send information response message
                    _session.SendMessage(informationResponse);
                }
                catch (Exception exp)
                {
                    _exception = exp;
                    _authenticationCompleted.Set();
                }
            });
        }
コード例 #5
0
        public void AuthenticationPromptAction(object sender, AuthenticationPromptEventArgs e)
        {
            Console.WriteLine("AuthenticationPromptAction");

            foreach (var p in e.Prompts)
            {
                p.Response = _interactiveMethod(new DSMKeyboardInteractiveEventArgs(_banner, e, p));
            }
        }
        public void AuthenticationPromptEventArgsConstructorTest()
        {
            string username    = string.Empty;                 // TODO: Initialize to an appropriate value
            string instruction = string.Empty;                 // TODO: Initialize to an appropriate value
            string language    = string.Empty;                 // TODO: Initialize to an appropriate value
            IEnumerable <AuthenticationPrompt> prompts = null; // TODO: Initialize to an appropriate value
            AuthenticationPromptEventArgs      target  = new AuthenticationPromptEventArgs(username, instruction, language, prompts);

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
コード例 #7
0
 private void authenticationPrompted(object sender, AuthenticationPromptEventArgs e, String password)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.StartsWith("Password:", StringComparison.InvariantCultureIgnoreCase))
         {
             prompt.Response = password;
         }
     }
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: evilbaschdi/UpdateEsxiSsh
 private static void HandleKeyEvent(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (var prompt in e.Prompts)
     {
         if (prompt.Request.IndexOf("Password:", StringComparison.CurrentCultureIgnoreCase) != -1)
         {
             prompt.Response = _password;
         }
     }
 }
コード例 #9
0
 private void HandleKeyEvent(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
         {
             prompt.Response = _zTransferFileSettings.Password;
         }
     }
 }
コード例 #10
0
 private void HandleKeyEvent(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.IndexOf("Password:"******"ESXI:password");
         }
     }
 }
コード例 #11
0
 internal DSMKeyboardInteractiveEventArgs(AuthenticationBannerEventArgs abe, AuthenticationPromptEventArgs ape, AuthenticationPrompt p)
 {
     if (abe != null) { Banner = abe.BannerMessage; } else { Banner = string.Empty; }
     Instruction = ape.Instruction;
     Language = ape.Language;
     Username = ape.Username;
     Request = p.Request;
     Id = p.Id;
     IsEchoed = p.IsEchoed;
 }
コード例 #12
0
 void HandleKeyEvent(Object sender, AuthenticationPromptEventArgs e)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
         {
             prompt.Response = credentials_.Password;
         }
     }
 }
コード例 #13
0
 void SftpWebRequest_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
         {
             prompt.Response = (m_cred as NetworkCredential).Password;
         }
     }
 }
コード例 #14
0
ファイル: Method.cs プロジェクト: nicon-83/otrs_daemon
 //обработчик события ввода пароля при подключении к серверу OTRS / имитация интерактивного ввода пароля
 public static void HandleKeyEvent(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.ToLower().IndexOf("password") != -1)
         {
             prompt.Response = "hidden";
         }
     }
 }
コード例 #15
0
 /// <summary>
 /// Handles the keyboard interactive authentication, should it be required.
 /// </summary>
 void kauth_AuthenticationPrompt(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
         {
             prompt.Response = Password;
         }
     }
 }
コード例 #16
0
        private void OnPasswordPrompt(object sender, AuthenticationPromptEventArgs authenticationPromptEventArgs)
        {
            foreach (
                var prompt in
                authenticationPromptEventArgs.Prompts.Where(prompt => prompt.Request.Contains("Password:"******"Tesira password prompt ... sending password");
#endif
                prompt.Response = _password;
            }
        }
コード例 #17
0
        private void AuthenticationPromptHandler(object sender, AuthenticationPromptEventArgs e)
        {
            Debug("Sending password");

            foreach (AuthenticationPrompt prompt in e.Prompts)
            {
                if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    prompt.Response = password;
                }
            }
        }
コード例 #18
0
ファイル: Ssh.cs プロジェクト: gavin1970/Linux-Commander
 /// <summary>
 /// Not sure this works as we have not needed it.
 /// However, if password is requested by server, it will pass what was used.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void HandleKeyEvent(object sender, AuthenticationPromptEventArgs e)
 {
     foreach (AuthenticationPrompt prompt in e.Prompts)
     {
         if (prompt.Request.IndexOf("Password:", StringComparison.InvariantCultureIgnoreCase) != -1)
         {
             if (DataFiles.CheckPass())
             {
                 prompt.Response = Defs.PassWord;
             }
         }
     }
 }
コード例 #19
0
 private bool Authenticate(out string username, out string password)
 {
     if (AuthenticationPrompt == null)
     {
         username = "";
         password = "";
         return(false);
     }
     else
     {
         var args = new AuthenticationPromptEventArgs();
         AuthenticationPrompt(this, args);
         username = args.Username;
         password = args.Password;
         return(args.Success);
     }
 }