aboutsummaryrefslogtreecommitdiffhomepage
path: root/infrastructure/Auth/Controllers
diff options
context:
space:
mode:
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