Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Move Auth and Authfront in new namespaces, respectively Auth\Driver a…
Browse files Browse the repository at this point in the history
…nd Auth\Frontend
  • Loading branch information
cdujeu committed Jun 22, 2016
1 parent 60e7b26 commit 7ea41f4
Show file tree
Hide file tree
Showing 68 changed files with 1,159 additions and 879 deletions.
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Controller/CliRunner.php
Expand Up @@ -20,7 +20,7 @@
*/
namespace Pydio\Core\Controller;

use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Services\UsersService;
Expand Down Expand Up @@ -109,7 +109,7 @@ public static function applyActionInBackground(ContextInterface $ctx, $actionNam
$repoObject = $ctx->getRepository();
$clearEnv = false;
if ($repoObject->getContextOption($ctx, "USE_SESSION_CREDENTIALS")) {
$encodedCreds = AJXP_Safe::getEncodedCredentialString();
$encodedCreds = MemorySafe::getEncodedCredentialString();
if (!empty($encodedCreds)) {
putenv("AJXP_SAFE_CREDENTIALS=" . $encodedCreds);
$clearEnv = "AJXP_SAFE_CREDENTIALS";
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Http/Cli/AuthCliMiddleware.php
Expand Up @@ -22,7 +22,7 @@

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;

use Pydio\Core\Exception\AuthRequiredException;
use Pydio\Core\Exception\LoginException;
Expand Down Expand Up @@ -129,7 +129,7 @@ public static function handleRequest(ServerRequestInterface $requestInterface, R
$optUser = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($optToken.$cKey), base64_decode($optUser), MCRYPT_MODE_ECB), "\0");
$env = getenv("AJXP_SAFE_CREDENTIALS");
if(!empty($env)){
$array = AJXP_Safe::getCredentialsFromEncodedString($env);
$array = MemorySafe::getCredentialsFromEncodedString($env);
if(isSet($array["user"]) && $array["user"] == $optUser){
unset($optToken);
$optPass = $array["password"];
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Http/Dav/AuthBackendBasic.php
Expand Up @@ -21,7 +21,7 @@

namespace Pydio\Core\Http\Dav;

use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;
use Pydio\Core\Exception\LoginException;
use Pydio\Core\Exception\RepositoryLoadException;
use Pydio\Core\Exception\UserNotFoundException;
Expand Down Expand Up @@ -142,7 +142,7 @@ public function authenticate(Sabre\DAV\Server $server, $realm)
// NOW UPDATE CONTEXT
$this->context->setUserId($this->currentUser);
if (ConfService::getContextConf($this->context, "SESSION_SET_CREDENTIALS", "auth")) {
AJXP_Safe::storeCredentials($this->currentUser, $userpass[1]);
MemorySafe::storeCredentials($this->currentUser, $userpass[1]);
}
//PluginsService::getInstance($this->context);
AJXP_Logger::updateContext($this->context);
Expand Down
4 changes: 2 additions & 2 deletions core/src/core/src/pydio/Core/Http/Dav/AuthBackendDigest.php
Expand Up @@ -30,7 +30,7 @@
use Pydio\Core\Services\UsersService;
use Pydio\Core\Utils\TextEncoder;
use \Sabre;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services\AuthService;
use Pydio\Core\Services\ConfService;
Expand Down Expand Up @@ -144,7 +144,7 @@ public function authenticate(Sabre\DAV\Server $server, $realm)
}
if (ConfService::getContextConf($this->context, "SESSION_SET_CREDENTIALS", "auth")) {
$webdavData = $loggedUser->getPref("AJXP_WEBDAV_DATA");
AJXP_Safe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
MemorySafe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
}

// NOW UPDATE CONTEXT
Expand Down
Expand Up @@ -21,7 +21,7 @@
namespace Pydio\Core\Http\Middleware;

use Psr\Http\Message\ServerRequestInterface;
use Pydio\Authfront\Core\FrontendsLoader;
use Pydio\Auth\Frontend\Core\FrontendsLoader;
use Pydio\Core\Exception\ActionNotFoundException;
use Pydio\Core\Exception\AuthRequiredException;
use Pydio\Core\Exception\NoActiveWorkspaceException;
Expand Down
Expand Up @@ -21,7 +21,7 @@
namespace Pydio\Core\Http\Rest;

use Psr\Http\Message\ServerRequestInterface;
use Pydio\Authfront\Core\FrontendsLoader;
use Pydio\Auth\Frontend\Core\FrontendsLoader;
use Pydio\Core\Exception\NoActiveWorkspaceException;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Exception\WorkspaceForbiddenException;
Expand Down
6 changes: 3 additions & 3 deletions core/src/core/src/pydio/Core/Services/AuthService.php
Expand Up @@ -19,7 +19,7 @@
* The latest code can be found at <http://pyd.io/>.
*/
namespace Pydio\Core\Services;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;
use Pydio\Conf\Core\AbstractAjxpUser;
use Pydio\Core\Controller\Controller;
use Pydio\Core\Exception\LoginException;
Expand Down Expand Up @@ -118,7 +118,7 @@ public static function logUser($user_id, $pwd, $bypass_pwd = false, $cookieLogin
// Setting session credentials if asked in config
if (ConfService::getContextConf(Context::contextWithObjects($user, null), "SESSION_SET_CREDENTIALS", "auth")) {
list($authId, $authPwd) = $authDriver->filterCredentials($user_id, $pwd);
AJXP_Safe::storeCredentials($authId, $authPwd);
MemorySafe::storeCredentials($authId, $authPwd);
}


Expand Down Expand Up @@ -173,7 +173,7 @@ public static function disconnect()
unset($_SESSION["AJXP_USER"]);
//if(isSet(self::$currentUser)) unset(self::$currentUser);
if (ConfService::getContextConf(Context::contextWithObjects($user, null), "SESSION_SET_CREDENTIALS", "auth")) {
AJXP_Safe::clearCredentials();
MemorySafe::clearCredentials();
}
Controller::applyHook("user.after_disconnect", array(Context::emptyContext(), $userId));
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/plugins/access.fs/class.fsAccessDriver.php
Expand Up @@ -37,7 +37,7 @@
use Pydio\Access\Core\RecycleBinManager;
use Pydio\Access\Core\Model\Repository;
use Pydio\Access\Core\Model\UserSelection;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;
use Pydio\Core\Http\Response\FileReaderResponse;
use Pydio\Core\Http\Response\SerializableResponseStream;
use Pydio\Core\Http\Message\UserMessage;
Expand Down Expand Up @@ -2327,7 +2327,7 @@ public function makeSharedRepositoryOptions(ContextInterface $ctx, $httpVars)
"DATA_TEMPLATE" => ""
];
if ($repository->getContextOption($ctx, "USE_SESSION_CREDENTIALS") === true) {
$newOptions["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
$newOptions["ENCODED_CREDENTIALS"] = MemorySafe::getEncodedCredentialString();
}
$customData = [];
foreach ($httpVars as $key => $value) {
Expand All @@ -2342,7 +2342,7 @@ public function makeSharedRepositoryOptions(ContextInterface $ctx, $httpVars)
$newOptions["META_SOURCES"] = $repository->getContextOption($ctx, "META_SOURCES");
foreach ($newOptions["META_SOURCES"] as $index => &$data) {
if (isSet($data["USE_SESSION_CREDENTIALS"]) && $data["USE_SESSION_CREDENTIALS"] === true) {
$newOptions["META_SOURCES"][$index]["ENCODED_CREDENTIALS"] = AJXP_Safe::getEncodedCredentialString();
$newOptions["META_SOURCES"][$index]["ENCODED_CREDENTIALS"] = MemorySafe::getEncodedCredentialString();
}
}
Controller::applyHook("workspace.share_metasources", [$ctx, &$newOptions["META_SOURCES"]]);
Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/access.ftp/class.ftpAccessWrapper.php
Expand Up @@ -24,7 +24,7 @@
use Pydio\Access\Core\AbstractAccessDriver;
use Pydio\Access\Core\IAjxpWrapper;
use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;
use Pydio\Core\Model\ContextInterface;


Expand Down Expand Up @@ -452,7 +452,7 @@ protected function parseUrl($url, $forceLogin = false)
throw new \Exception("Cannot find repository for dynamic ftp authentication.");
}
$ctx = $node->getContext();
$credentials = AJXP_Safe::tryLoadingCredentialsFromSources($node->getContext());
$credentials = MemorySafe::tryLoadingCredentialsFromSources($node->getContext());
$this->user = $credentials["user"];
$this->password = $credentials["password"];
if ($this->user=="") {
Expand Down
6 changes: 3 additions & 3 deletions core/src/plugins/access.sftp/class.sftpAccessWrapper.php
Expand Up @@ -25,7 +25,7 @@
use Pydio\Access\Core\Model\AJXP_Node;

use Pydio\Access\Driver\StreamProvider\FS\fsAccessWrapper;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;
use Pydio\Core\Model\ContextInterface;

use Pydio\Core\Utils\Utils;
Expand Down Expand Up @@ -133,7 +133,7 @@ protected static function getSftpResource($context)
'macerror' => "macerrorSftp");
$remote_serv = $repoObject->getContextOption($context, "SERV");
$remote_port = $repoObject->getContextOption($context, "PORT");
$credentials = AJXP_Safe::tryLoadingCredentialsFromSources($context);
$credentials = MemorySafe::tryLoadingCredentialsFromSources($context);
$remote_user = $credentials["user"];
$remote_pass = $credentials["password"];

Expand Down Expand Up @@ -322,7 +322,7 @@ public static function getSshConnection(ContextInterface $ctx)
$repoObject = $ctx->getRepository();
$remote_serv = $repoObject->getContextOption($ctx, "SERV");
$remote_port = $repoObject->getContextOption($ctx, "PORT");
$credentials = AJXP_Safe::tryLoadingCredentialsFromSources($ctx);
$credentials = MemorySafe::tryLoadingCredentialsFromSources($ctx);
$remote_user = $credentials["user"];
$remote_pass = $credentials["password"];
$remote_base_path = $repoObject->getContextOption($ctx, "PATH");
Expand Down
Expand Up @@ -26,7 +26,7 @@
use Pydio\Access\Core\Model\AJXP_Node;

use Pydio\Access\Driver\StreamProvider\FS\fsAccessWrapper;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;

use Pydio\Core\Utils\Utils;
use Pydio\Log\Core\AJXP_Logger;
Expand Down Expand Up @@ -74,7 +74,7 @@ protected static function initPath($path, $streamType = '', $storeOpenContext =
$host = $repoObject->getContextOption($ctx, "SFTP_HOST");
$port = $repoObject->getContextOption($ctx, "SFTP_PORT");

$credentials = AJXP_Safe::tryLoadingCredentialsFromSources($node->getContext());
$credentials = MemorySafe::tryLoadingCredentialsFromSources($node->getContext());
$user = $credentials["user"];
$pass = $credentials["password"];

Expand Down Expand Up @@ -194,7 +194,7 @@ public function detectRemoteUserId($node)
$host = $repoObject->getContextOption($ctx, "SFTP_HOST");
$port = $repoObject->getContextOption($ctx, "SFTP_PORT");

$credentials = AJXP_Safe::tryLoadingCredentialsFromSources($node->getContext());
$credentials = MemorySafe::tryLoadingCredentialsFromSources($node->getContext());
$user = $credentials["user"];
$pass = $credentials["password"];

Expand Down
4 changes: 2 additions & 2 deletions core/src/plugins/access.smb/class.smbAccessWrapper.php
Expand Up @@ -23,7 +23,7 @@

use Pydio\Access\Core\Model\AJXP_Node;
use Pydio\Access\Driver\StreamProvider\FS\fsAccessWrapper;
use Pydio\Auth\Core\AJXP_Safe;
use Pydio\Auth\Core\MemorySafe;


use Pydio\Core\Utils\Utils;
Expand Down Expand Up @@ -71,7 +71,7 @@ protected static function initPath($path, $streamType, $storeOpenContext = false
}
$host = str_replace("//", "", $hostOption);
$credentials = "";
$safeCreds = AJXP_Safe::tryLoadingCredentialsFromSources($node->getContext());
$safeCreds = MemorySafe::tryLoadingCredentialsFromSources($node->getContext());
if ($safeCreds["user"] != "" && $safeCreds["password"] != "") {
$login = $safeCreds["user"];
$pass = $safeCreds["password"];
Expand Down

0 comments on commit 7ea41f4

Please sign in to comment.