Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-09 13:51:09 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-09 20:49:35 +0300
commitf8808e260dacfd8214e405d493365f4ecaf4d953 (patch)
tree6eaffc3c6d52f8a1eac63646f6728eabcbc8032c /core/Controller
parent9eea1e56dc0c33c504fb0e98578e22115b6b4c79 (diff)
Move app_password_created to a typed event
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/AppPasswordController.php13
-rw-r--r--core/Controller/ClientFlowLoginController.php15
2 files changed, 15 insertions, 13 deletions
diff --git a/core/Controller/AppPasswordController.php b/core/Controller/AppPasswordController.php
index 2f8c1184def..15f86b4ad6a 100644
--- a/core/Controller/AppPasswordController.php
+++ b/core/Controller/AppPasswordController.php
@@ -27,6 +27,7 @@ declare(strict_types=1);
namespace OC\Core\Controller;
+use OC\Authentication\Events\AppPasswordCreatedEvent;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
@@ -35,11 +36,10 @@ use OCP\AppFramework\OCS\OCSForbiddenException;
use OCP\Authentication\Exceptions\CredentialsUnavailableException;
use OCP\Authentication\Exceptions\PasswordUnavailableException;
use OCP\Authentication\LoginCredentials\IStore;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest;
use OCP\ISession;
use OCP\Security\ISecureRandom;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
class AppPasswordController extends \OCP\AppFramework\OCSController {
@@ -55,7 +55,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
/** @var IStore */
private $credentialStore;
- /** @var EventDispatcherInterface */
+ /** @var IEventDispatcher */
private $eventDispatcher;
public function __construct(string $appName,
@@ -64,7 +64,7 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
ISecureRandom $random,
IProvider $tokenProvider,
IStore $credentialStore,
- EventDispatcherInterface $eventDispatcher) {
+ IEventDispatcher $eventDispatcher) {
parent::__construct($appName, $request);
$this->session = $session;
@@ -112,8 +112,9 @@ class AppPasswordController extends \OCP\AppFramework\OCSController {
IToken::DO_NOT_REMEMBER
);
- $event = new GenericEvent($generatedToken);
- $this->eventDispatcher->dispatch('app_password_created', $event);
+ $this->eventDispatcher->dispatchTyped(
+ new AppPasswordCreatedEvent($generatedToken)
+ );
return new DataResponse([
'apppassword' => $token
diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php
index 9a7296281b0..b7599acc3c6 100644
--- a/core/Controller/ClientFlowLoginController.php
+++ b/core/Controller/ClientFlowLoginController.php
@@ -32,6 +32,7 @@
namespace OC\Core\Controller;
+use OC\Authentication\Events\AppPasswordCreatedEvent;
use OC\Authentication\Exceptions\InvalidTokenException;
use OC\Authentication\Exceptions\PasswordlessTokenException;
use OC\Authentication\Token\IProvider;
@@ -44,6 +45,7 @@ use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
use OCP\Defaults;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\IL10N;
use OCP\IRequest;
use OCP\ISession;
@@ -52,8 +54,6 @@ use OCP\IUserSession;
use OCP\Security\ICrypto;
use OCP\Security\ISecureRandom;
use OCP\Session\Exceptions\SessionNotAvailableException;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-use Symfony\Component\EventDispatcher\GenericEvent;
class ClientFlowLoginController extends Controller {
/** @var IUserSession */
@@ -76,7 +76,7 @@ class ClientFlowLoginController extends Controller {
private $accessTokenMapper;
/** @var ICrypto */
private $crypto;
- /** @var EventDispatcherInterface */
+ /** @var IEventDispatcher */
private $eventDispatcher;
public const STATE_NAME = 'client.flow.state.token';
@@ -94,7 +94,7 @@ class ClientFlowLoginController extends Controller {
* @param ClientMapper $clientMapper
* @param AccessTokenMapper $accessTokenMapper
* @param ICrypto $crypto
- * @param EventDispatcherInterface $eventDispatcher
+ * @param IEventDispatcher $eventDispatcher
*/
public function __construct($appName,
IRequest $request,
@@ -108,7 +108,7 @@ class ClientFlowLoginController extends Controller {
ClientMapper $clientMapper,
AccessTokenMapper $accessTokenMapper,
ICrypto $crypto,
- EventDispatcherInterface $eventDispatcher) {
+ IEventDispatcher $eventDispatcher) {
parent::__construct($appName, $request);
$this->userSession = $userSession;
$this->l10n = $l10n;
@@ -364,8 +364,9 @@ class ClientFlowLoginController extends Controller {
$this->tokenProvider->invalidateToken($sessionId);
}
- $event = new GenericEvent($generatedToken);
- $this->eventDispatcher->dispatch('app_password_created', $event);
+ $this->eventDispatcher->dispatchTyped(
+ new AppPasswordCreatedEvent($generatedToken)
+ );
return new Http\RedirectResponse($redirectUri);
}