aboutsummaryrefslogtreecommitdiffhomepage
path: root/infrastructure/Auth/Controllers
diff options
context:
space:
mode:
authorMarvin Borner2018-07-20 16:34:32 +0200
committerMarvin Borner2018-07-20 16:34:32 +0200
commit74cb1477bb921a2378ea22a552b71a48c11e0931 (patch)
tree621ab17315be667c16dad8f3d5f44d67a7a47e8f /infrastructure/Auth/Controllers
parent400591b34d4b0a6288834539808a9dede8a60e3a (diff)
Better API (integrated oauth completely)
Diffstat (limited to 'infrastructure/Auth/Controllers')
-rw-r--r--infrastructure/Auth/Controllers/LoginController.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/infrastructure/Auth/Controllers/LoginController.php b/infrastructure/Auth/Controllers/LoginController.php
new file mode 100644
index 0000000..a72f8a0
--- /dev/null
+++ b/infrastructure/Auth/Controllers/LoginController.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Infrastructure\Auth\Controllers;
+
+use Illuminate\Http\Request;
+use Infrastructure\Auth\LoginProxy;
+use Infrastructure\Auth\Requests\LoginRequest;
+use Infrastructure\Http\Controller;
+
+class LoginController extends Controller
+{
+ private $loginProxy;
+
+ public function __construct(LoginProxy $loginProxy)
+ {
+ $this->loginProxy = $loginProxy;
+ }
+
+ public function login(LoginRequest $request)
+ {
+ $email = $request->get('email');
+ $password = $request->get('password');
+
+ return $this->response($this->loginProxy->attemptLogin($email, $password));
+ }
+
+ public function refresh(Request $request)
+ {
+ return $this->response($this->loginProxy->attemptRefresh());
+ }
+
+ public function logout()
+ {
+ $this->loginProxy->logout();
+
+ return $this->response(null, 204);
+ }
+} \ No newline at end of file