for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LibSSH2\Authentication;
use LibSSH2\Configuration;
/**
* Password class.
*
* Username and password based authentication.
* @package LibSSH2\Authentication
*/
class Password extends Configuration implements Authentication
{
* Username.
* @var string
protected $username;
* Password.
protected $password;
* Constructor.
* @param object $configuration Configuration object
* @return void
public function __construct(Configuration $configuration)
$this->username = $configuration->get_username();
$this->password = $configuration->get_password();
}
* {@inheritDoc}
final public function authenticate($resource)
if (@ssh2_auth_password($resource, $this->username, $this->password) === FALSE)
throw new \RuntimeException('Password based authentication failed.');