From 18e6796726d73d7dc90ecdd16c181493941f5487 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 15 Dec 2016 10:13:00 +0100 Subject: REST API structure using Slim framework * REST API routes are handle by Slim. * Every API controller go through ApiMiddleware which handles security. * First service implemented `/info`, for tests purpose. --- application/api/ApiUtils.php | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 application/api/ApiUtils.php (limited to 'application/api/ApiUtils.php') diff --git a/application/api/ApiUtils.php b/application/api/ApiUtils.php new file mode 100644 index 00000000..fbb1e72f --- /dev/null +++ b/application/api/ApiUtils.php @@ -0,0 +1,51 @@ +iat) + || $payload->iat > time() + || time() - $payload->iat > ApiMiddleware::$TOKEN_DURATION + ) { + throw new ApiAuthorizationException('Invalid JWT issued time'); + } + } +} -- cgit v1.2.3