summaryrefslogtreecommitdiff
path: root/src/Controllers
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-25 18:53:05 +0200
committermsquare <msquare@notrademark.de>2019-06-12 10:24:02 +0200
commit6ed891fc0416e8025f929cf60a07b1020118b221 (patch)
tree17e6a0d312693838133cb8241320424b9c0fcd1e /src/Controllers
parent2e51fbff9d8472a0e98af39aff52d30f0b67706b (diff)
Added logout via AuthController
Diffstat (limited to 'src/Controllers')
-rw-r--r--src/Controllers/AuthController.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Controllers/AuthController.php b/src/Controllers/AuthController.php
new file mode 100644
index 00000000..cdaee167
--- /dev/null
+++ b/src/Controllers/AuthController.php
@@ -0,0 +1,36 @@
+<?php
+
+namespace Engelsystem\Controllers;
+
+use Engelsystem\Http\Response;
+use Engelsystem\Http\UrlGeneratorInterface;
+use Symfony\Component\HttpFoundation\Session\SessionInterface;
+
+class AuthController extends BaseController
+{
+ /** @var Response */
+ protected $response;
+
+ /** @var SessionInterface */
+ protected $session;
+
+ /** @var UrlGeneratorInterface */
+ protected $url;
+
+ public function __construct(Response $response, SessionInterface $session, UrlGeneratorInterface $url)
+ {
+ $this->response = $response;
+ $this->session = $session;
+ $this->url = $url;
+ }
+
+ /**
+ * @return Response
+ */
+ public function logout()
+ {
+ $this->session->invalidate();
+
+ return $this->response->redirectTo($this->url->to('/'));
+ }
+}