mirror of
https://github.com/friendica/friendica
synced 2025-04-22 12:30:12 +00:00
OpenWebAuth moved to a separate class / Improved authentication handling
This commit is contained in:
parent
b3c7e96b73
commit
55cec6c61d
14 changed files with 595 additions and 410 deletions
|
@ -32,12 +32,12 @@ use Friendica\Core\Session\Capability\IHandleUserSessions;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Response;
|
||||
use Friendica\Navigation\SystemMessages;
|
||||
use Friendica\Network\HTTPException\ForbiddenException;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Security\OpenWebAuth;
|
||||
use Friendica\Util\Profiler;
|
||||
use Friendica\Util\Strings;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
|
@ -175,7 +175,7 @@ class Follow extends BaseModule
|
|||
'$action' => $requestUrl,
|
||||
'$name' => $contact['name'],
|
||||
'$url' => $contact['url'],
|
||||
'$zrl' => Profile::zrl($contact['url']),
|
||||
'$zrl' => OpenWebAuth::getZrlUrl($contact['url']),
|
||||
'$myaddr' => $myaddr,
|
||||
'$keywords' => $contact['keywords'],
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ use Friendica\DI;
|
|||
use Friendica\Model;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Security\OpenWebAuth;
|
||||
|
||||
/**
|
||||
* Shows the local directory of this node
|
||||
|
@ -63,7 +64,7 @@ class Directory extends BaseModule
|
|||
$gDirPath = '';
|
||||
$dirURL = Search::getGlobalDirectory();
|
||||
if (strlen($dirURL)) {
|
||||
$gDirPath = Profile::zrl($dirURL, true);
|
||||
$gDirPath = OpenWebAuth::getZrlUrl($dirURL, true);
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 60);
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
namespace Friendica\Module;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Contact\Header;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Protocol;
|
||||
|
@ -30,7 +29,6 @@ use Friendica\DI;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Photo as MPhoto;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Core\Storage\Type\ExternalResource;
|
||||
use Friendica\Core\Storage\Type\SystemResource;
|
||||
use Friendica\Core\System;
|
||||
|
@ -42,8 +40,8 @@ use Friendica\Network\HTTPClient\Client\HttpClientRequest;
|
|||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Network\HTTPException\NotModifiedException;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Security\OpenWebAuth;
|
||||
use Friendica\Util\Images;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\ParseUrl;
|
||||
use Friendica\Util\Proxy;
|
||||
use Friendica\Worker\UpdateContact;
|
||||
|
@ -78,7 +76,7 @@ class Photo extends BaseApi
|
|||
throw new NotModifiedException();
|
||||
}
|
||||
|
||||
Profile::addVisitorCookieForHTTPSigner($this->server);
|
||||
OpenWebAuth::addVisitorCookieForHTTPSigner($this->server);
|
||||
|
||||
$customsize = 0;
|
||||
$square_resize = true;
|
||||
|
|
|
@ -29,6 +29,7 @@ use Friendica\Core\Hook;
|
|||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
|
@ -51,11 +52,16 @@ class Register extends BaseModule
|
|||
/** @var Tos */
|
||||
protected $tos;
|
||||
|
||||
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, array $server, array $parameters = [])
|
||||
/** @var IHandleUserSessions */
|
||||
private $session;
|
||||
|
||||
public function __construct(IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->tos = new Tos($l10n, $baseUrl, $args, $logger, $profiler, $response, $config, $server, $parameters);
|
||||
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -242,7 +248,7 @@ class Register extends BaseModule
|
|||
|
||||
case self::CLOSED:
|
||||
default:
|
||||
if (empty($_SESSION['authenticated']) && empty($_SESSION['administrator'])) {
|
||||
if (!$this->session->isSiteAdmin()) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.'));
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue