@@ -8,11 +8,8 @@ use OCP\AppFramework\App;
|
|||||||
use OCP\AppFramework\Bootstrap\IBootContext;
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||||
use OCP\Notification\IManager;
|
|
||||||
use OCP\User\Events;
|
|
||||||
|
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap {
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
parent::__construct('user_external');
|
parent::__construct('user_external');
|
||||||
}
|
}
|
||||||
@@ -22,5 +19,4 @@ class Application extends App implements IBootstrap {
|
|||||||
|
|
||||||
public function boot(IBootContext $context): void {
|
public function boot(IBootContext $context): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ namespace OCA\UserExternal;
|
|||||||
* @license http://www.gnu.org/licenses/agpl AGPL
|
* @license http://www.gnu.org/licenses/agpl AGPL
|
||||||
* @link http://github.com/owncloud/apps
|
* @link http://github.com/owncloud/apps
|
||||||
*/
|
*/
|
||||||
abstract class Base extends \OC\User\Backend{
|
abstract class Base extends \OC\User\Backend {
|
||||||
protected $backend = '';
|
protected $backend = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +80,6 @@ abstract class Base extends \OC\User\Backend{
|
|||||||
* @return array with all displayNames (value) and the corresponding uids (key)
|
* @return array with all displayNames (value) and the corresponding uids (key)
|
||||||
*/
|
*/
|
||||||
public function getDisplayNames($search = '', $limit = null, $offset = null) {
|
public function getDisplayNames($search = '', $limit = null, $offset = null) {
|
||||||
|
|
||||||
$connection = \OC::$server->getDatabaseConnection();
|
$connection = \OC::$server->getDatabaseConnection();
|
||||||
$query = $connection->getQueryBuilder();
|
$query = $connection->getQueryBuilder();
|
||||||
$query->select('uid', 'displayname')
|
$query->select('uid', 'displayname')
|
||||||
@@ -231,5 +230,4 @@ abstract class Base extends \OC\User\Backend{
|
|||||||
|
|
||||||
return $users > 0;
|
return $users > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,11 @@
|
|||||||
namespace OCA\UserExternal;
|
namespace OCA\UserExternal;
|
||||||
|
|
||||||
class BasicAuth extends Base {
|
class BasicAuth extends Base {
|
||||||
|
|
||||||
private $authUrl;
|
private $authUrl;
|
||||||
|
|
||||||
public function __construct($authUrl) {
|
public function __construct($authUrl) {
|
||||||
parent::__construct($authUrl);
|
parent::__construct($authUrl);
|
||||||
$this->authUrl =$authUrl;
|
$this->authUrl = $authUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +36,7 @@ class BasicAuth extends Base {
|
|||||||
))
|
))
|
||||||
);
|
);
|
||||||
$canary = get_headers($this->authUrl, 1, $context);
|
$canary = get_headers($this->authUrl, 1, $context);
|
||||||
if(!$canary) {
|
if (!$canary) {
|
||||||
\OC::$server->getLogger()->error(
|
\OC::$server->getLogger()->error(
|
||||||
'ERROR: Not possible to connect to BasicAuth Url: '.$this->authUrl,
|
'ERROR: Not possible to connect to BasicAuth Url: '.$this->authUrl,
|
||||||
['app' => 'user_external']
|
['app' => 'user_external']
|
||||||
@@ -61,7 +60,7 @@ class BasicAuth extends Base {
|
|||||||
);
|
);
|
||||||
$headers = get_headers($this->authUrl, 1, $context);
|
$headers = get_headers($this->authUrl, 1, $context);
|
||||||
|
|
||||||
if(!$headers) {
|
if (!$headers) {
|
||||||
\OC::$server->getLogger()->error(
|
\OC::$server->getLogger()->error(
|
||||||
'ERROR: Not possible to connect to BasicAuth Url: '.$this->authUrl,
|
'ERROR: Not possible to connect to BasicAuth Url: '.$this->authUrl,
|
||||||
['app' => 'user_external']
|
['app' => 'user_external']
|
||||||
|
|||||||
20
lib/FTP.php
20
lib/FTP.php
@@ -17,7 +17,7 @@ namespace OCA\UserExternal;
|
|||||||
* @license http://www.gnu.org/licenses/agpl AGPL
|
* @license http://www.gnu.org/licenses/agpl AGPL
|
||||||
* @link http://github.com/owncloud/apps
|
* @link http://github.com/owncloud/apps
|
||||||
*/
|
*/
|
||||||
class FTP extends Base{
|
class FTP extends Base {
|
||||||
private $host;
|
private $host;
|
||||||
private $secure;
|
private $secure;
|
||||||
private $protocol;
|
private $protocol;
|
||||||
@@ -28,12 +28,12 @@ class FTP extends Base{
|
|||||||
* @param string $host Hostname or IP of FTP server
|
* @param string $host Hostname or IP of FTP server
|
||||||
* @param boolean $secure TRUE to enable SSL
|
* @param boolean $secure TRUE to enable SSL
|
||||||
*/
|
*/
|
||||||
public function __construct($host,$secure=false) {
|
public function __construct($host, $secure = false) {
|
||||||
$this->host=$host;
|
$this->host = $host;
|
||||||
$this->secure=$secure;
|
$this->secure = $secure;
|
||||||
$this->protocol='ftp';
|
$this->protocol = 'ftp';
|
||||||
if($this->secure) {
|
if ($this->secure) {
|
||||||
$this->protocol.='s';
|
$this->protocol .= 's';
|
||||||
}
|
}
|
||||||
parent::__construct($this->protocol . '://' . $this->host);
|
parent::__construct($this->protocol . '://' . $this->host);
|
||||||
}
|
}
|
||||||
@@ -56,11 +56,11 @@ class FTP extends Base{
|
|||||||
}
|
}
|
||||||
// opendir handles the as %-encoded string, but this is not true for usernames and passwords, encode them before passing them
|
// opendir handles the as %-encoded string, but this is not true for usernames and passwords, encode them before passing them
|
||||||
$url = sprintf('%s://%s:%s@%s/', $this->protocol, urlencode($uid), urlencode($password), $this->host);
|
$url = sprintf('%s://%s:%s@%s/', $this->protocol, urlencode($uid), urlencode($password), $this->host);
|
||||||
$result=@opendir($url);
|
$result = @opendir($url);
|
||||||
if(is_resource($result)) {
|
if (is_resource($result)) {
|
||||||
$this->storeUser($uid);
|
$this->storeUser($uid);
|
||||||
return $uid;
|
return $uid;
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
*/
|
*/
|
||||||
namespace OCA\UserExternal;
|
namespace OCA\UserExternal;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User authentication against an IMAP mail server
|
* User authentication against an IMAP mail server
|
||||||
*
|
*
|
||||||
@@ -59,14 +58,14 @@ class IMAP extends Base {
|
|||||||
// Replace escaped @ symbol in uid (which is a mail address)
|
// Replace escaped @ symbol in uid (which is a mail address)
|
||||||
// but only if there is no @ symbol and if there is a %40 inside the uid
|
// but only if there is no @ symbol and if there is a %40 inside the uid
|
||||||
if (!(strpos($uid, '@') !== false) && (strpos($uid, '%40') !== false)) {
|
if (!(strpos($uid, '@') !== false) && (strpos($uid, '%40') !== false)) {
|
||||||
$uid = str_replace("%40","@",$uid);
|
$uid = str_replace("%40", "@", $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pieces = explode('@', $uid);
|
$pieces = explode('@', $uid);
|
||||||
if ($this->domain !== '') {
|
if ($this->domain !== '') {
|
||||||
if (count($pieces) === 1) {
|
if (count($pieces) === 1) {
|
||||||
$username = $uid . '@' . $this->domain;
|
$username = $uid . '@' . $this->domain;
|
||||||
} else if(count($pieces) === 2 && $pieces[1] === $this->domain) {
|
} elseif (count($pieces) === 2 && $pieces[1] === $this->domain) {
|
||||||
$username = $uid;
|
$username = $uid;
|
||||||
if ($this->stripeDomain) {
|
if ($this->stripeDomain) {
|
||||||
$uid = $pieces[0];
|
$uid = $pieces[0];
|
||||||
@@ -101,7 +100,7 @@ class IMAP extends Base {
|
|||||||
|
|
||||||
$canconnect = curl_exec($ch);
|
$canconnect = curl_exec($ch);
|
||||||
|
|
||||||
if($canconnect) {
|
if ($canconnect) {
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
$uid = mb_strtolower($uid);
|
$uid = mb_strtolower($uid);
|
||||||
$this->storeUser($uid, $groups);
|
$this->storeUser($uid, $groups);
|
||||||
|
|||||||
18
lib/SMB.php
18
lib/SMB.php
@@ -16,11 +16,11 @@ namespace OCA\UserExternal;
|
|||||||
* @license http://www.gnu.org/licenses/agpl AGPL
|
* @license http://www.gnu.org/licenses/agpl AGPL
|
||||||
* @link http://github.com/owncloud/apps
|
* @link http://github.com/owncloud/apps
|
||||||
*/
|
*/
|
||||||
class SMB extends Base{
|
class SMB extends Base {
|
||||||
private $host;
|
private $host;
|
||||||
|
|
||||||
const SMBCLIENT = 'smbclient -L';
|
public const SMBCLIENT = 'smbclient -L';
|
||||||
const LOGINERROR = 'NT_STATUS_LOGON_FAILURE';
|
public const LOGINERROR = 'NT_STATUS_LOGON_FAILURE';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new samba authentication provider
|
* Create new samba authentication provider
|
||||||
@@ -29,7 +29,7 @@ class SMB extends Base{
|
|||||||
*/
|
*/
|
||||||
public function __construct($host) {
|
public function __construct($host) {
|
||||||
parent::__construct($host);
|
parent::__construct($host);
|
||||||
$this->host=$host;
|
$this->host = $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,13 +48,13 @@ class SMB extends Base{
|
|||||||
['app' => 'user_external']
|
['app' => 'user_external']
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
} else if (strpos($lastline, self::LOGINERROR) !== false) {
|
} elseif (strpos($lastline, self::LOGINERROR) !== false) {
|
||||||
//normal login error
|
//normal login error
|
||||||
return false;
|
return false;
|
||||||
} else if (strpos($lastline, 'NT_STATUS_BAD_NETWORK_NAME') !== false) {
|
} elseif (strpos($lastline, 'NT_STATUS_BAD_NETWORK_NAME') !== false) {
|
||||||
//login on minor error
|
//login on minor error
|
||||||
goto login;
|
goto login;
|
||||||
} else if ($retval !== 0) {
|
} elseif ($retval !== 0) {
|
||||||
//some other error
|
//some other error
|
||||||
\OC::$server->getLogger()->error(
|
\OC::$server->getLogger()->error(
|
||||||
'ERROR: smbclient error: ' . trim($lastline),
|
'ERROR: smbclient error: ' . trim($lastline),
|
||||||
@@ -78,13 +78,13 @@ class SMB extends Base{
|
|||||||
public function checkPassword($uid, $password) {
|
public function checkPassword($uid, $password) {
|
||||||
// Check with an invalid password, if the user authenticates then fail
|
// Check with an invalid password, if the user authenticates then fail
|
||||||
$attemptWithInvalidPassword = $this->tryAuthentication($uid, base64_encode($password));
|
$attemptWithInvalidPassword = $this->tryAuthentication($uid, base64_encode($password));
|
||||||
if(is_string($attemptWithInvalidPassword)) {
|
if (is_string($attemptWithInvalidPassword)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check with valid password
|
// Check with valid password
|
||||||
$attemptWithValidPassword = $this->tryAuthentication($uid, $password);
|
$attemptWithValidPassword = $this->tryAuthentication($uid, $password);
|
||||||
if(is_string($attemptWithValidPassword)) {
|
if (is_string($attemptWithValidPassword)) {
|
||||||
$this->storeUser($uid);
|
$this->storeUser($uid);
|
||||||
return $uid;
|
return $uid;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,11 @@
|
|||||||
namespace OCA\UserExternal;
|
namespace OCA\UserExternal;
|
||||||
|
|
||||||
class WebDavAuth extends Base {
|
class WebDavAuth extends Base {
|
||||||
|
|
||||||
private $webDavAuthUrl;
|
private $webDavAuthUrl;
|
||||||
|
|
||||||
public function __construct($webDavAuthUrl) {
|
public function __construct($webDavAuthUrl) {
|
||||||
parent::__construct($webDavAuthUrl);
|
parent::__construct($webDavAuthUrl);
|
||||||
$this->webDavAuthUrl =$webDavAuthUrl;
|
$this->webDavAuthUrl = $webDavAuthUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,21 +26,20 @@ class WebDavAuth extends Base {
|
|||||||
*/
|
*/
|
||||||
public function checkPassword($uid, $password) {
|
public function checkPassword($uid, $password) {
|
||||||
$arr = explode('://', $this->webDavAuthUrl, 2);
|
$arr = explode('://', $this->webDavAuthUrl, 2);
|
||||||
if( ! isset($arr) OR count($arr) !== 2) {
|
if (! isset($arr) or count($arr) !== 2) {
|
||||||
\OC::$server->getLogger()->error('ERROR: Invalid WebdavUrl: "'.$this->webDavAuthUrl.'" ', ['app' => 'user_external']);
|
\OC::$server->getLogger()->error('ERROR: Invalid WebdavUrl: "'.$this->webDavAuthUrl.'" ', ['app' => 'user_external']);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
list($protocol, $path) = $arr;
|
list($protocol, $path) = $arr;
|
||||||
$url= $protocol.'://'.urlencode($uid).':'.urlencode($password).'@'.$path;
|
$url = $protocol.'://'.urlencode($uid).':'.urlencode($password).'@'.$path;
|
||||||
$headers = get_headers($url);
|
$headers = get_headers($url);
|
||||||
if($headers === false) {
|
if ($headers === false) {
|
||||||
\OC::$server->getLogger()->error('ERROR: Not possible to connect to WebDAV Url: "'.$protocol.'://'.$path.'" ', ['app' => 'user_external']);
|
\OC::$server->getLogger()->error('ERROR: Not possible to connect to WebDAV Url: "'.$protocol.'://'.$path.'" ', ['app' => 'user_external']);
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
$returnCode= substr($headers[0], 9, 3);
|
$returnCode = substr($headers[0], 9, 3);
|
||||||
|
|
||||||
if(substr($returnCode, 0, 1) === '2') {
|
if (substr($returnCode, 0, 1) === '2') {
|
||||||
$this->storeUser($uid);
|
$this->storeUser($uid);
|
||||||
return $uid;
|
return $uid;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
20
lib/XMPP.php
20
lib/XMPP.php
@@ -51,15 +51,15 @@ class XMPP extends Base {
|
|||||||
return sha1($oPad.sha1($iPad.$data, true));
|
return sha1($oPad.sha1($iPad.$data, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateHashedPassword($user, $uid, $submittedPassword){
|
public function validateHashedPassword($user, $uid, $submittedPassword) {
|
||||||
foreach ($user as $key){
|
foreach ($user as $key) {
|
||||||
if($key[3] === "salt") {
|
if ($key[3] === "salt") {
|
||||||
$internalSalt = $key['value'];
|
$internalSalt = $key['value'];
|
||||||
}
|
}
|
||||||
if($key[3] === "server_key") {
|
if ($key[3] === "server_key") {
|
||||||
$internalServerKey = $key['value'];
|
$internalServerKey = $key['value'];
|
||||||
}
|
}
|
||||||
if($key[3] === "stored_key") {
|
if ($key[3] === "stored_key") {
|
||||||
$internalStoredKey = $key['value'];
|
$internalStoredKey = $key['value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ class XMPP extends Base {
|
|||||||
|
|
||||||
public function validatePlainPassword($user, $uid, $submittedPassword) {
|
public function validatePlainPassword($user, $uid, $submittedPassword) {
|
||||||
foreach ($user as $key) {
|
foreach ($user as $key) {
|
||||||
if($key[3] === "password") {
|
if ($key[3] === "password") {
|
||||||
$internalPlainPassword = $key['value'];
|
$internalPlainPassword = $key['value'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,11 +96,11 @@ class XMPP extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkPassword($uid, $password){
|
public function checkPassword($uid, $password) {
|
||||||
$pdo = new \PDO("mysql:host=$this->host;dbname=$this->xmppDb", $this->xmppDbUser, $this->xmppDbPassword);
|
$pdo = new \PDO("mysql:host=$this->host;dbname=$this->xmppDb", $this->xmppDbUser, $this->xmppDbPassword);
|
||||||
if(isset($uid)
|
if (isset($uid)
|
||||||
&& isset($password)) {
|
&& isset($password)) {
|
||||||
if(!filter_var($uid, FILTER_VALIDATE_EMAIL)
|
if (!filter_var($uid, FILTER_VALIDATE_EMAIL)
|
||||||
|| !strpos($uid, $this->xmppDomain)
|
|| !strpos($uid, $this->xmppDomain)
|
||||||
|| substr($uid, -strlen($this->xmppDomain)) !== $this->xmppDomain
|
|| substr($uid, -strlen($this->xmppDomain)) !== $this->xmppDomain
|
||||||
) {
|
) {
|
||||||
@@ -115,7 +115,7 @@ class XMPP extends Base {
|
|||||||
'xmppDomain' => $this->xmppDomain
|
'xmppDomain' => $this->xmppDomain
|
||||||
));
|
));
|
||||||
$user = $statement->fetchAll();
|
$user = $statement->fetchAll();
|
||||||
if(empty($user)) {
|
if (empty($user)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,20 +16,20 @@ class Test_User_BasicAuth extends \Test\TestCase {
|
|||||||
return include(__DIR__.'/config.php');
|
return include(__DIR__.'/config.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
function skip() {
|
public function skip() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->skipUnless($config['basic_auth']['run']);
|
$this->skipUnless($config['basic_auth']['run']);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->instance=new OC_User_BasicAuth($config['basic_auth']['url']);
|
$this->instance = new OC_User_BasicAuth($config['basic_auth']['url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLogin() {
|
public function testLogin() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->assertEquals($config['basic_auth']['user'],$this->instance->checkPassword($config['basic_auth']['user'],$config['basic_auth']['password']));
|
$this->assertEquals($config['basic_auth']['user'], $this->instance->checkPassword($config['basic_auth']['user'], $config['basic_auth']['password']));
|
||||||
$this->assertFalse($this->instance->checkPassword($config['basic_auth']['user'],$config['basic_auth']['password'].'foo'));
|
$this->assertFalse($this->instance->checkPassword($config['basic_auth']['user'], $config['basic_auth']['password'].'foo'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (!defined('PHPUNIT_RUN')) {
|
if (!defined('PHPUNIT_RUN')) {
|
||||||
define('PHPUNIT_RUN', 1);
|
define('PHPUNIT_RUN', 1);
|
||||||
}
|
}
|
||||||
@@ -9,7 +10,7 @@ if (!class_exists('\PHPUnit\Framework\TestCase')) {
|
|||||||
\OC_App::loadApp('user_external');
|
\OC_App::loadApp('user_external');
|
||||||
|
|
||||||
$dummyClass = \OC::$SERVERROOT . '/tests/lib/Util/User/Dummy.php';
|
$dummyClass = \OC::$SERVERROOT . '/tests/lib/Util/User/Dummy.php';
|
||||||
if(file_exists($dummyClass)) {
|
if (file_exists($dummyClass)) {
|
||||||
require_once($dummyClass);
|
require_once($dummyClass);
|
||||||
}
|
}
|
||||||
OC_Hook::clear();
|
OC_Hook::clear();
|
||||||
|
|||||||
@@ -8,28 +8,28 @@
|
|||||||
|
|
||||||
OC_App::loadApp('user_external');
|
OC_App::loadApp('user_external');
|
||||||
return array(
|
return array(
|
||||||
'imap'=>array(
|
'imap' => array(
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'mailbox'=>'{imap.gmail.com:993/imap/ssl}INBOX', //see http://php.net/manual/en/function.imap-open.php
|
'mailbox' => '{imap.gmail.com:993/imap/ssl}INBOX', //see http://php.net/manual/en/function.imap-open.php
|
||||||
'user'=>'foo',//valid username/password combination
|
'user' => 'foo',//valid username/password combination
|
||||||
'password'=>'bar',
|
'password' => 'bar',
|
||||||
),
|
),
|
||||||
'smb'=>array(
|
'smb' => array(
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'host'=>'localhost',
|
'host' => 'localhost',
|
||||||
'user'=>'test',//valid username/password combination
|
'user' => 'test',//valid username/password combination
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
),
|
),
|
||||||
'ftp'=>array(
|
'ftp' => array(
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'host'=>'localhost',
|
'host' => 'localhost',
|
||||||
'user'=>'test',//valid username/password combination
|
'user' => 'test',//valid username/password combination
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
),
|
),
|
||||||
'basic_auth'=>array(
|
'basic_auth' => array(
|
||||||
'run'=>false,
|
'run' => false,
|
||||||
'url'=>'localhost/basic_auth',
|
'url' => 'localhost/basic_auth',
|
||||||
'user'=>'test',//valid username/password combination
|
'user' => 'test',//valid username/password combination
|
||||||
'password'=>'test',
|
'password' => 'test',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,20 +16,20 @@ class Test_User_FTP extends \Test\TestCase {
|
|||||||
return include(__DIR__.'/config.php');
|
return include(__DIR__.'/config.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
function skip() {
|
public function skip() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->skipUnless($config['ftp']['run']);
|
$this->skipUnless($config['ftp']['run']);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->instance=new OC_User_FTP($config['ftp']['host']);
|
$this->instance = new OC_User_FTP($config['ftp']['host']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLogin() {
|
public function testLogin() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->assertEquals($config['ftp']['user'],$this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password']));
|
$this->assertEquals($config['ftp']['user'], $this->instance->checkPassword($config['ftp']['user'], $config['ftp']['password']));
|
||||||
$this->assertFalse($this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password'].'foo'));
|
$this->assertFalse($this->instance->checkPassword($config['ftp']['user'], $config['ftp']['password'].'foo'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,21 +16,21 @@ class Test_User_Imap extends \Test\TestCase {
|
|||||||
return include(__DIR__.'/config.php');
|
return include(__DIR__.'/config.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
function skip() {
|
public function skip() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->skipUnless($config['imap']['run']);
|
$this->skipUnless($config['imap']['run']);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->instance=new OC_User_IMAP($config['imap']['mailbox']);
|
$this->instance = new OC_User_IMAP($config['imap']['mailbox']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLogin() {
|
public function testLogin() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->assertEquals($config['imap']['user'],$this->instance->checkPassword($config['imap']['user'],$config['imap']['password']));
|
$this->assertEquals($config['imap']['user'], $this->instance->checkPassword($config['imap']['user'], $config['imap']['password']));
|
||||||
$this->assertFalse($this->instance->checkPassword($config['imap']['user'],$config['imap']['password'].'foo'));
|
$this->assertFalse($this->instance->checkPassword($config['imap']['user'], $config['imap']['password'].'foo'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,21 +16,21 @@ class Test_User_SMB extends \Test\TestCase {
|
|||||||
return include(__DIR__.'/config.php');
|
return include(__DIR__.'/config.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
function skip() {
|
public function skip() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->skipUnless($config['smb']['run']);
|
$this->skipUnless($config['smb']['run']);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->instance=new OC_User_SMB($config['smb']['host']);
|
$this->instance = new OC_User_SMB($config['smb']['host']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLogin() {
|
public function testLogin() {
|
||||||
$config=$this->getConfig();
|
$config = $this->getConfig();
|
||||||
$this->assertEquals($config['smb']['user'],$this->instance->checkPassword($config['smb']['user'],$config['smb']['password']));
|
$this->assertEquals($config['smb']['user'], $this->instance->checkPassword($config['smb']['user'], $config['smb']['password']));
|
||||||
$this->assertFalse($this->instance->checkPassword($config['smb']['user'],$config['smb']['password'].'foo'));
|
$this->assertFalse($this->instance->checkPassword($config['smb']['user'], $config['smb']['password'].'foo'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user