summaryrefslogtreecommitdiff
path: root/src/Controllers
diff options
context:
space:
mode:
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('/'));
+ }
+}