Password.php (815B)
1 <?php 2 3 namespace Ssh\Authentication; 4 5 use Ssh\Authentication; 6 7 /** 8 * Password Authentication 9 * 10 * @author Antoine Hérault <antoine.herault@gmail.com> 11 */ 12 class Password implements Authentication 13 { 14 protected $username; 15 protected $password; 16 17 /** 18 * Constructor 19 * 20 * @param string $username The authentication username 21 * @param string $password The authentication password 22 */ 23 public function __construct($username, $password) 24 { 25 $this->username = $username; 26 $this->password = $password; 27 } 28 29 /** 30 * {@inheritDoc} 31 */ 32 public function authenticate($session) 33 { 34 // This function generates a undocumented warning on authentification failure. 35 return @ssh2_auth_password($session, $this->username, $this->password); 36 } 37 }