| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 | <?xml version="1.0" encoding="utf-8"?><topic id="b7b599b2-8bc2-4276-b9a2-d73eee2426ab" revisionNumber="1">  <developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">    <introduction>      <para>        This section will describe how to establish connection using username and password combination.        You can provide username/password combination either directly in the client constractor using <codeEntityReference>T:Renci.SshNet.PasswordConnectionInfo</codeEntityReference> class.        You use <codeEntityReference>T:Renci.SshNet.PasswordConnectionInfo</codeEntityReference> object when you need to provide additional such as timeout or simple to handle different events that can occur when establishing connection.      </para>      <list class="bullet">        <listItem>          <para>            <link xlink:href="#UseUsernamePasswordSection">Use username and password to connect.</link>          </para>        </listItem>        <listItem>          <para>            <link xlink:href="#UsePasswordConnectionInfoSection">Use PasswordConnectionInfo to connect.</link>          </para>        </listItem>        <listItem>          <para>            <link xlink:href="#HandleExpiredPasswordSection">Handle expired password.</link>          </para>        </listItem>      </list>    </introduction>    <section address="UseUsernamePasswordSection">      <title>Use username and password to connect</title>      <content>        <para>          In many scenarious all you need to know is host, username and password to establish connection, in this case you can provide this information directly to the client object.        </para>        <code language="cs" title="Use username and password to connect example">          <![CDATA[        using (var client = new SshClient("host", "username", "password"))      {      client.Connect();            ....            client.Disconnect();      }      ]]>        </code>      </content>    </section>    <section address="UsePasswordConnectionInfoSection">      <title>Use PasswordConnectionInfo to connect</title>      <content>        <para>          To get more control over connection proccess when using username and password combination you need to use <codeEntityReference>T:Renci.SshNet.PasswordConnectionInfo</codeEntityReference> object.        </para>        <code language="cs" title="How to use PasswordConnectionInfo example">          <![CDATA[        var connectionInfo = new PasswordConnectionInfo("host", "username", "password");      using (var client = new SftpClient(connectionInfo))      {      client.Connect();            ...            client.Disconnect();      }      ]]>        </code>      </content>    </section>    <section address="UsePasswordConnectionInfoSection">      <title>Use PasswordConnectionInfo to connect</title>      <content>        <para>          To get more control over connection proccess when using username and password combination you need to use <codeEntityReference>T:Renci.SshNet.PasswordConnectionInfo</codeEntityReference> object.        </para>        <code language="cs" title="How to use PasswordConnectionInfo example">          <![CDATA[        var connectionInfo = new PasswordConnectionInfo("host", "username", "password");      // Attach to connection event if needed here      using (var client = new SftpClient(connectionInfo))      {      client.Connect();            ...            client.Disconnect();      }      ]]>        </code>      </content>    </section>    <section address="HandleExpiredPasswordSection">      <title>Handle expired password</title>      <content>        <para>          When user logs on and his password is expired you can ask user for a new passowrd and change it.          <alert class="note">            <para>The event handler will be executed on new thread</para>          </alert>        </para>        <code language="cs" title="How to change expired password example">          <![CDATA[                var connectionInfo = new PasswordConnectionInfo("host", "username", "password");              connectionInfo.PasswordExpired += delegate(object sender, AuthenticationPasswordChangeEventArgs e)              {                e.NewPassword = "123456";              };              using (var client = new SshClient(connectionInfo))              {                client.Connect();                                ....                                client.Disconnect();              }      ]]>        </code>      </content>    </section>    <relatedTopics>      <codeEntityReference>T:Renci.SshNet.PasswordConnectionInfo</codeEntityReference>      <codeEntityReference>T:Renci.SshNet.SshClient</codeEntityReference>      <codeEntityReference>M:Renci.SshNet.SshBaseClient.Connect</codeEntityReference>    </relatedTopics>  </developerConceptualDocument></topic>
 |