From edca3db592a4464da42f573934888d215a392999 Mon Sep 17 00:00:00 2001 From: Maicon Amarante Date: Tue, 12 Apr 2016 15:46:47 -0300 Subject: [PATCH 1/2] enable stateless authentication system --- src/Auth/ApiKeyAuthenticate.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Auth/ApiKeyAuthenticate.php b/src/Auth/ApiKeyAuthenticate.php index e667d29bb..51d279ac8 100644 --- a/src/Auth/ApiKeyAuthenticate.php +++ b/src/Auth/ApiKeyAuthenticate.php @@ -49,6 +49,24 @@ class ApiKeyAuthenticate extends BaseAuthenticate * @return mixed */ public function authenticate(Request $request, Response $response) + { + return $this->getUser($request); + } + + /** + * Stateless Authentication System + * http://book.cakephp.org/3.0/en/controllers/components/authentication.html#creating-stateless-authentication-systems + * + * Config: + * $this->Auth->config('storage', 'Memory'); + * $this->Auth->config('unauthorizedRedirect', 'false'); + * $this->Auth->config('checkAuthIn', 'Controller.initialize'); + * $this->Auth->config('loginAction', false); + * + * @param Request $request Cake request object. + * @return mixed + */ + public function getUser(Request $request) { $type = $this->config('type'); if (!in_array($type, $this->types)) { From 50b29f42aea3112c496787eb921e5d9d66ce4f5e Mon Sep 17 00:00:00 2001 From: Maicon Amarante Date: Tue, 12 Apr 2016 15:46:47 -0300 Subject: [PATCH 2/2] enable stateless authentication system --- src/Auth/ApiKeyAuthenticate.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Auth/ApiKeyAuthenticate.php b/src/Auth/ApiKeyAuthenticate.php index e667d29bb..51d279ac8 100644 --- a/src/Auth/ApiKeyAuthenticate.php +++ b/src/Auth/ApiKeyAuthenticate.php @@ -49,6 +49,24 @@ class ApiKeyAuthenticate extends BaseAuthenticate * @return mixed */ public function authenticate(Request $request, Response $response) + { + return $this->getUser($request); + } + + /** + * Stateless Authentication System + * http://book.cakephp.org/3.0/en/controllers/components/authentication.html#creating-stateless-authentication-systems + * + * Config: + * $this->Auth->config('storage', 'Memory'); + * $this->Auth->config('unauthorizedRedirect', 'false'); + * $this->Auth->config('checkAuthIn', 'Controller.initialize'); + * $this->Auth->config('loginAction', false); + * + * @param Request $request Cake request object. + * @return mixed + */ + public function getUser(Request $request) { $type = $this->config('type'); if (!in_array($type, $this->types)) {