diff options
author | Guillaume Mazoyer <respawneral@gmail.com> | 2014-06-01 01:38:42 +0200 |
---|---|---|
committer | Guillaume Mazoyer <respawneral@gmail.com> | 2014-06-01 01:38:42 +0200 |
commit | c805f575bf01028722271b420e1a18a53d85985f (patch) | |
tree | 93f08728c5a9bee712174f70d57e6ff43aa5786c /router.php | |
parent | 8f0ce0135c1f12a07eeefc432bf9af28ee1a67c6 (diff) |
Add telnet based authentication.
Continue authentication rewrite. Use abstract class with factory instanciation.
Diffstat (limited to 'router.php')
-rw-r--r-- | router.php | 21 |
1 files changed, 5 insertions, 16 deletions
@@ -21,7 +21,7 @@ require_once 'config.php'; require_once 'utils.php'; -require_once 'auth/ssh.php'; +require_once 'auth/authentication.php'; class Router { private $id; @@ -106,21 +106,10 @@ class Router { } $data = null; - - if ($this->auth == 'ssh-password') { - if ($this->port != null) { - $connection = new SSH($this->host, $this->port); - } else { - $connection = new SSH($this->host); - } - - $connection->set_type_auth_password( - $config['routers'][$this->id]['user'], - $config['routers'][$this->id]['pass']); - $connection->connect(); - $data = $connection->send_command($complete_command); - $connection->disconnect(); - } + $auth = Authentication::instance($config['routers'][$this->id]); + $auth->connect(); + $data = $auth->send_command($complete_command); + $auth->disconnect(); $this->log_command('['.date("Y-m-d H:i:s").'] [client: '. $this->requester.'] '.$this->host.'> '.$complete_command."\n"); |